I'm working on a converting a c program to java for the blackberry and I was wondering what is the best way to convert the following c snippet to java.
typedef struct foo
unsigned int field1:12;
unsigned int field2:4;
unsigned int field3:16;
I was going to create a class to encapsulate everything however getting the data packed into a byte array correctly is bothering me. I know it's going to involve some bit shifting but i have no idea how to do it at the moment.