I am tring to convert a set of strings to a byte[] array. At first, I do something like this to convert a byte array to a string:
public String convertByte(byte[
I don't understand why you are trying to get those bytes by characters. getBytes() and its variants will give you a byte[] array for whole string at once. However, if you want to see how characters are encoded, your approach my be good, but you have to keep in mind, that one character could be encoded in e.g. one to four bytes in some encodings, thus you need a byte array for every character.