Convert DWORD to a unsigned long number

Anyone know how to convert Dword LITTLE_ENDIAN to an unsigned long number or float value?

Something along the following lines should get you going in the right direction. There should be plenty of Java examples out there but this is one possible way:

<cfscript>
ByteBuffer = createObject( "java", "java.nio.ByteBuffer" );
result = ByteBuffer.wrap( [DWORD_as_byte] ).order( ByteOrder.LITTLE_ENDIAN ).getInt();
// may need to bitAnd() with lower order bytes (0xffffffffL) to get unsigned int
writeDump( result );
</cfscript>

Potential further reading on using ByteBuffer in CF: Experimenting With ByteBuffer In ColdFusion For Binary Manipulation

HTH

1 Like