Here you can find the source of convertToString(final byte[] bytes, final Charset charset)
public static String convertToString(final byte[] bytes, final Charset charset)
//package com.java2s; //License from project: Open Source License import java.nio.charset.Charset; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String convertToString(final byte[] bytes, final Charset charset) { return new String(bytes, charset); }//from www . ja v a 2 s. com public static String convertToString(final byte[] bytes, final String charsetName) { return convertToString(bytes, Charset.forName(charsetName)); } public static String convertToString(final byte[] bytes) { return convertToString(bytes, Charset.defaultCharset()); } public static String convertToString(final char[] chars) { return new String(chars); } public static String convertToString(final short s) { return String.valueOf(s); } public static String convertToString(final int i) { return String.valueOf(i); } public static String convertToString(final long l) { return String.valueOf(l); } public static String convertToString(final float f) { return String.valueOf(f); } public static String convertToString(final double d) { return String.valueOf(d); } public static String convertToString(final Date date, final DateFormat dateFormat) { return dateFormat.format(date); } public static String convertToString(final Date date, final String format) { return convertToString(date, new SimpleDateFormat(format)); } }