Java Byte Array to String bytesToStr(byte[] input)

Here you can find the source of bytesToStr(byte[] input)

Description

bytes To Str

License

Apache License

Declaration

public static String bytesToStr(byte[] input) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String bytesToStr(byte[] input) {
        String res = "";
        for (byte b : input) {
            res += byteToStr(b);//from   w  w  w.  ja  va 2  s  .co  m
        }
        return res;
    }

    private static String byteToStr(byte input) {
        String res = Integer.toHexString(input & 0xff);
        if (res.length() < 2) {
            res = "0" + res;
        }
        return res;
    }
}

Related

  1. bytes2String(byte[] bytesArray)
  2. bytes2String(byte[] data)
  3. bytes2string(byte[] src)
  4. bytes2string(byte[] src)
  5. bytesToStr(byte[] bytes)
  6. bytesToStrHex(byte[] bytes)
  7. bytesToString(byte... bytes)
  8. bytesToString(byte[] arr)
  9. bytesToString(byte[] arr, int pos)