View Single Post
Old 08-13-2008, 11:39 AM   #1 (permalink)
op1984
New Member
 
Join Date: Aug 2008
Model: curve
PIN: N/A
Carrier: tmobile
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default C conversion issue

Please Login to Remove!

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.

Code:
	typedef struct foo
	{
		unsigned int field1:12;
		unsigned int field2:4; 
		unsigned int field3:16;
		
	}foo_type;
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.

Any ideas,
Thanks
Offline   Reply With Quote