Here you can find the source of getBytes(String str)
public static byte[] getBytes(String str)
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { private static final String CHARSET_NAME = "UTF-8"; public static byte[] getBytes(String str) { if (str != null) { try { return str.getBytes(CHARSET_NAME); } catch (UnsupportedEncodingException e) { return null; }//from w w w. jav a 2s .c om } else { return null; } } }