Java Array to String bytesToString(byte[] buffer)

Here you can find the source of bytesToString(byte[] buffer)

Description

bytes To String

License

Open Source License

Declaration

private static String bytesToString(byte[] buffer) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;

public class Main {
    private static String bytesToString(byte[] buffer) {
        byte[] bytes = null;

        for (int i = 0; i < buffer.length; i++) {
            if (buffer[i] == '\0') {
                bytes = Arrays.copyOfRange(buffer, 0, i);
                break;
            }/*from ww  w . j av a2s . co m*/
        }

        return new String(bytes);
    }
}

Related

  1. asString(String[] arrayParameter)
  2. asString(T[] objects)
  3. asStringOn(StringBuilder sb, Object[] items, String separator)
  4. bitsToString(int[] arr)
  5. byteMapToString(Map map)
  6. convertArrayToString(double[] p)
  7. convertArrayToString(Object param)
  8. convertArrayToString(Object[] array, String separator)
  9. convertArrayToString(Object[] ig, int count)