Here you can find the source of toStringWithLength(byte[] b, int pos, int length)
public static String toStringWithLength(byte[] b, int pos, int length)
//package com.java2s; public class Main { public static String toStringWithLength(byte[] b, int pos, int length) { StringBuilder str = new StringBuilder(); for (int i = 0; i < length; i++) { str.append((char) b[pos + i]); }//from w ww .j av a2 s.c o m String ret = str.toString(); return ret; } }