>1) I am starting out a byte array of lenght 20.
>2) Next I need to determin the offsetbits, which are supposed to to be
>the low order 4 bits of byte[19]. How do I determine this?
>3)How do I convert this value in to an Int ?

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
> see http://mindprod.com/jgloss/masking.html
>
> http://mindprod.com/jgloss/binary.html
Not really related to the OP, but I've always wondered if bit manipulations
in Java are really performant? In (relatively low to the ground) languages
like C and C++ manipulating individual bits can be done for reasons of
memory usage and/or speed. But does that apply for Java too, or does the
JVM handle bit manipulations in a way that levels out these advantages?
And if you're going to use bits, is it better to use a BitSet, or just use
raw data types and manipulate those bits? Anyone have some insight in
this?

Signature
Beware the False Authority Syndrome
Roedy Green - 26 Nov 2005 19:16 GMT
>Not really related to the OP, but I've always wondered if bit manipulations
>in Java are really performant? In (relatively low to the ground) languages
[quoted text clipped - 4 lines]
>raw data types and manipulate those bits? Anyone have some insight in
>this?
The JVM has bit operators that map very directly onto the bit
manipulation operators of most modern CPUs, so I would expect longs
and ints to do equally well to C with Hotspot or AOT compilers.
BitSet is for sets larger than 64 bits. It does the housekeeping to
simulate long bit strings with an array of longs.
see http://mindprod.com/jgloss/binary.html#BITSET

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
zero - 26 Nov 2005 19:35 GMT
> The JVM has bit operators that map very directly onto the bit
> manipulation operators of most modern CPUs, so I would expect longs
[quoted text clipped - 4 lines]
>
> see http://mindprod.com/jgloss/binary.html#BITSET
That's a very clear and helpful answer, thanks Roedy :-)

Signature
Beware the False Authority Syndrome
Luc The Perverse - 26 Nov 2005 20:38 GMT
To think that Sun would deliberately pass up a possible speed advantage by
choosing some form of integer arithmatic over binary ops, is ludicrous.
Now yes, if there is some hardware platform out there which does not contain
native implementations for these calls (I don't know of any) then the JVM
would have to work around that.

Signature
ALEX TAYLOR
>
>> see http://mindprod.com/jgloss/masking.html
[quoted text clipped - 11 lines]
> raw data types and manipulate those bits? Anyone have some insight in
> this?