I was used Hex.encodeHexString(byte[] hexStringByteArray); api for convert byte array to String but in two different situations not able to get the excepted values.
Excepted String tcpPort = "1443";
In byte array [5,-93] --> In Hex String : 05a3
byte[] value1 = new byte[]{[5, -93]};
String tcpPort1 = Hex.encodeHexString(value1); // Incorrect value 05a3
Excepted String bufferSize = "0578";
In byte array [[5, 120] --> In Hex String : 0578
String bufferSize = "0578"; // in byte array [5,120]
byte[] value2 = new byte[]{[5, 120]};
String bufferSize = Hex.encodeHexString(value1); --- Correct value 0578
1 is incorrect and 2 is correct. Please help on this. I have to correct both values in same way.