Click here to Skip to main content
15,891,864 members
Home / Discussions / Java
   

Java

 
AnswerRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
42774802-Oct-09 22:12
42774802-Oct-09 22:12 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
pohcb_sonic3-Oct-09 4:44
pohcb_sonic3-Oct-09 4:44 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
pohcb_sonic3-Oct-09 4:44
pohcb_sonic3-Oct-09 4:44 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
Richard MacCutchan3-Oct-09 5:39
mveRichard MacCutchan3-Oct-09 5:39 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
42774803-Oct-09 8:53
42774803-Oct-09 8:53 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
Richard MacCutchan3-Oct-09 21:38
mveRichard MacCutchan3-Oct-09 21:38 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
42774804-Oct-09 0:10
42774804-Oct-09 0:10 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
Richard MacCutchan4-Oct-09 1:15
mveRichard MacCutchan4-Oct-09 1:15 
pohcb_sonic wrote:
However, when I tried to send data over to the other PC, the message being sent over looks something like "@.pp...." in my output, which is incorrect. I wanted the output to be in hex, something like
"AA BC 25 EE AC...".


Member 4277480 posted this code:

  public static void main(String[] args) throws IOException{
    BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter the byte number:");
    byte b =(byte)6;
    String str = buff.readLine();
    int i =Integer.parseInt(str);
    String hexString = Integer.toHexString(i);
    System.out.println("Hexa is:=" + hexString);
  }
}


I don't see what the following statement is for:
byte b =(byte)6;


The remaining code reads some input from the console, parses it to an integer and then displays it in Hex. This is not converting the characters of the message passing between the two PCs.
Or did I miss something obvious?
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
42774804-Oct-09 2:40
42774804-Oct-09 2:40 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
Richard MacCutchan4-Oct-09 4:01
mveRichard MacCutchan4-Oct-09 4:01 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) [modified] Pin
pohcb_sonic4-Oct-09 17:21
pohcb_sonic4-Oct-09 17:21 
AnswerRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
42774804-Oct-09 22:15
42774804-Oct-09 22:15 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
regionwar5-Oct-09 2:35
regionwar5-Oct-09 2:35 
GeneralRe: Problem : Reading and Writing of Byte[] Array Messages to Serial Comm (Serial Port RS232) Pin
pohcb_sonic6-Oct-09 14:18
pohcb_sonic6-Oct-09 14:18 
Generalhelp regarding j2ee Pin
madhu91241-Oct-09 1:24
madhu91241-Oct-09 1:24 
GeneralRe: help regarding j2ee Pin
Nagy Vilmos1-Oct-09 3:12
professionalNagy Vilmos1-Oct-09 3:12 
GeneralRe: help regarding j2ee Pin
madhu91242-Oct-09 1:34
madhu91242-Oct-09 1:34 
QuestionStruts - tiles Pin
sangeethanarayan30-Sep-09 21:04
sangeethanarayan30-Sep-09 21:04 
AnswerRe: Struts - tiles Pin
427748030-Sep-09 21:56
427748030-Sep-09 21:56 
QuestionSending mails by lotus notes using javascript Pin
divya.katti30-Sep-09 20:46
divya.katti30-Sep-09 20:46 
AnswerRe: Sending mails by lotus notes using javascript Pin
427748030-Sep-09 21:55
427748030-Sep-09 21:55 
QuestionCreating PDF Pin
akashj8730-Sep-09 9:32
akashj8730-Sep-09 9:32 
AnswerRe: Creating PDF Pin
427748030-Sep-09 10:51
427748030-Sep-09 10:51 
AnswerRe: Creating PDF Pin
Richard MacCutchan30-Sep-09 11:28
mveRichard MacCutchan30-Sep-09 11:28 
AnswerRe: Creating PDF Pin
Member 827588228-Sep-11 9:59
Member 827588228-Sep-11 9:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.