Thread: Java Help
View Single Post
  #12  
Old March 21, 2005, 08:48 PM
Rubu's Avatar
Rubu Rubu is offline
Moderator
 
Join Date: February 15, 2004
Location: Michigan
Favorite Player: Mashrafee Mortaza
Posts: 8,361

once again, i'm stuck: this time a bit more complicated. see if anyone can give some tips.

overveiw: i'm writting a software to operate a device (an RFID). it operates in bitwise command. i need to send a packet of binary (=hex) number through rs232 serial port.

problem: the packet has to be in the grup of 8 bits (1 byte). i did it in C, they have this "unsigned char" that has 8 bit. problem with java is, its char is 16 bits(2 bytes). i tryed to use "byte" type variable in java, but i can't. because i can't assign something like

byte var1=0xFF; i'm not able to change the Most sig bit to 1.
and if i'm using a bigger variable say char or int, my device will not take it since they are padded with a huge line of zeros. what can i do? any idea?

in short, i need 8 bit of space where i can use all eight.
Reply With Quote