Here you can find the source of getBytes(String s, String charsetName)
public static byte[] getBytes(String s, String charsetName)
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { public static byte[] getBytes(String s, String charsetName) { if (s == null) { return null; }//from w w w . j a v a 2s. c om try { return s.getBytes(charsetName); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }