You have to construct a new string out of a byte array. The first element in your byteArray
should be 0x63
. If you want to add any more letters, make the byteArray
longer and add them to the next indices.
byte[] byteArray = new byte[1];
byteArray[0] = 0x63;
try {
System.out.println("string " + new String(byteArray, "US-ASCII"));
} catch (UnsupportedEncodingException e) {
// TODO: Handle exception.
e.printStackTrace();
}
Note that specifying the encoding will eventually throw an UnsupportedEncodingException
and you must handle that accordingly.