I am parsing in Java a byte array having the following specification:
Trace data format:
- 4 bytes containing the Id.
- 4 bytes containing the addres
Assuming the first and last name are null-terminated you would do it like this:
int firstNameLength = 0;
while(firstNameLength<32) {
if(theArray[firstNameLength]=='0') break;
firstNameLength++;
}
int lastNameLength = 0;
while(lastNameLength<32) {
if(theArray[8+firstNameLength+1+lastNameLength]=='0') break;
i++;
}
String firstName = new String(theArray).substring(8,8+firstNameLength);
String lastName = new String(theArray).substring(8+firstNameLength+1,8+firstNameLength+1+lastNameLength);