Here you can find the source of arrayToString(byte[] source, int index, short size)
public static String arrayToString(byte[] source, int index, short size)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; public class Main { public static String arrayToString(byte[] source, int index, short size) { byte[] array = new byte[size * 2]; for (int i = index; i <= (size * 2) + 2; i++) { array[i - index] = source[i]; }//from w ww . java2 s . c om String string = "UNDEFINED"; try { string = new String(array, 0, array.length, "UTF-16BE"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return string; } }