php Pack/unpack unsigned integer equivalent
800349Nov 3 2010 — edited Nov 3 2010I'm trying to port some PHP code into Java which contains calls to Pack and Unpack which I'm trying to use which I'm having some problems with converting.
I realise Java doesn't have these functions but I've been fiddling around and looking around the net trying to get a solution. The php is using 'I' as its format mask which is Unsigned Integer so I've used :
Integer.toBinaryString(toStringInt)
which should be returning the unsigned integer but I'm having trouble trying to get it back from the binary string.
When I stick the result of the above code into Integer.parseInt(string, int) it gives me a number format exception
Can anyone help?
Thanks