Here you can find the source of decode(byte[] src, String charset)
public static String decode(byte[] src, String charset)
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { public static String decode(byte[] src, String charset) { return decode(src, 0, src.length, charset); }//from w w w .jav a 2 s .c o m public static String decode(byte[] src, int offset, int length, String charset) { try { return new String(src, offset, length, charset); } catch (UnsupportedEncodingException e) { return new String(src, offset, length); } } }