I am actually reading int values from the java socket bufferedread and later converting into hex representation. I am using a method as below.
StringBuilder sb = new StringBuilder();
sb.append(Integer.toHexString(nextChar));
if (sb.length() < 2) {
sb.insert(0, '0'); //pad with leading zero if needed
}
String hexChar = sb.toString();
System.out.println("\n\n hex value is "+hexChar +" "+"Int value is:"+nextChar);
The codes are working fine. Only I got one or two data which in normal case after conversion into hex is either BE or A9 but I am getting ffdd and the integer value is 65533. Could it be my conversion method is wrong or is it input value is it self is having that value?