Java Array to String arrayToString(byte[] source, int index, short size)

Here you can find the source of arrayToString(byte[] source, int index, short size)

Description

array To String

License

Open Source License

Declaration

public static String arrayToString(byte[] source, int index, short size) 

Method Source Code


//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;
    }
}

Related

  1. ArrayToStr(String[] strArr, String seperatedBy)
  2. arrayToStr(String[] strArray)
  3. arrayToString(byte[] arg)
  4. arrayToString(byte[] array)
  5. arrayToString(byte[] bytes)
  6. arrayToString(double d[])
  7. arrayToString(double... a)
  8. arrayToString(double[] array)
  9. arrayToString(double[] array, String separator)