Good morning. I have an eletronic project in which I receive a variable from a RS232 device. That variable needs to be converted into an HEX type with their digits separated by a space in pairs, for example like the following structure: "12 42 15 54"
public static void main(String[] args) {
int ch = -1;
String chave = "";
while(ch != 'Q') {
ch = inStream.read();
if (ch >= 0) {
outStream.write(ch);
System.out.print((char)ch);
String hexch = Integer.toHexString(ch);
System.out.print(hexch);
}
}
The code I used to convert into Hex is commentated but basically I want to rebuild the way I store the "ch" variable. I need the project to be compiled via JDE 1.3 so that is stricting my options. I researched in the forum but I couldn't find the answer.
Thanks!