Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { public static String dataToString(byte[] data, String charsetName) { if (data != null) { try { return new String(data, charsetName); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return null; } }