Here you can find the source of encodeAsUtf8(byte[] bytes)
public static String encodeAsUtf8(byte[] bytes)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; public class Main { public static final String UTF_8 = "UTF-8"; public static String encodeAsUtf8(byte[] bytes) { try {//from www . j av a 2 s .c om return new String(bytes, UTF_8); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }