You must exactly know what is going on under the hood in method
byte[] bytestring= somefunction();
For exampple what is it converted fron a specific text encoding to byte array,
and what i have seen, you just try to convert it bytes with UTF encoding , and check thei equality