Java Compare Byte Array To String, Java String to Byte Array We can convert String to byte array using getBytes () method.