String to ByteArray in Java

public class StringToByteArray {
        public static void main(String args[]){
                String str = "Forget Code";
                byte[] bytes = str.getBytes();
        }
}