Spendius wrote:
> Er... Sorry but none of your solutions work. If I edit my
> bin. file with a hex editor for instance, where I see the
> line
> # 07 03 23 23 23 04 63 63 20 20 3c 01 03 02 c1 06
> ^^ ^^ ^^ ^^
> if I put the 4 bytes 63, 20, 20 and 3c in a four-position
> array, I'd like my 'toInt(byte[] b)' function to return
> me the value 1 663 049 788. To be simpler if I had the
> 4 hex values 00 00 00 0a, I'd be returned the value 10...
>
> With your stuffs when I have an hex value of 50, I'm returned
> an integer value of 50 ! Yet 50 in hex == 80 in decimal
> notation...
Real bytes have no real format -- they're just a value. It's up to the
language to provide representations of the bytes, and typically this
will be in decimal, unless you set the representation accordingly (for
hard-coded values, '50' in Java will be decimal 50, wheras for hex
you'll want to use "0x50").
If you're doing the conversions from Strings, then you're not really
working with byte values, but with string values that represent a byte.
In the future it is a good idea to quote at least a small piece of the
post you're replying to so people know which post in the thread you're
commenting on.
Brad BARCLAY
--
=-=-=-=-=-=-=-=-=
From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
The jSyncManager Project:
http://www.jsyncmanager.org