I just need to create a byte array out of the given String.
For example, if my String is String ss = "21331UA"; then the byte array elements should correspond to them as follows.
2 1 3 3 1 U A
I could have created it statically as this. byte[] arr = new byte[]{2,1,3,3,1,'U','A'} But have to create this byte array in the runtime dyanamically as this changes time to time. Thats the problem.
I just tried as follows and print them, it contains their corresponding ASCII values.This is not what I want.
byte[] arr = ss.getBytes();
for(int i=0; i<arr.length; i++)
{
System.out.print(arr[i] + " ");
}
Ans==> 50 49 51 51 49 85 65
Really appreciate any guidance.... Thanks in advance
getBytes()is the correct dynamic way of getting those values.