I am trying to developing a java card application. There will a dynamic input string which will contain a phone number in a byte array like:
byte[] number =new byte[] {1,2,3,4,5,6,7,8,9,5};
I want this array to be changed into following array:
byte[] changed num = {(byte)0x0C, (byte)0x91, (byte)0x19, (byte)0x21, (byte)0x43, (byte)0x65, (byte)0x87, (byte)0x59}
Where first three bytes will be same always and remaining 5 will be update from the incoming array.
I have tried the following:
public static void main(String args[]){
byte[] number =new byte[] {1,2,3,4,5,6,7,8,9,5};
byte[] changednum = new byte[8];
changednum[0] = (byte)0x0C;
changednum[1] = (byte)0x91;
changednum[2] = (byte)0x19;
changednum[3] = (byte)0x(number[0] + number[1]*10);
changednum[4] = (byte)0x(number[2] + number[3]*10);
changednum[5] = (byte)0x(number[4] + number[5]*10);
changednum[6] = (byte)0x(number[6] + number[7]*10);
changednum[7] = (byte)0x(number[8] + number[9]*10);
System.out.println(Arrays.toString(changednum));
}
}
But the last 5 values are not being converted to byte value
s.