Here you can find the source of ASCIIByteArrayToString(byte[] data)
Parameter | Description |
---|---|
data | the input byte array |
public static String ASCIIByteArrayToString(byte[] data)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w. j ava2 s .c o m * Convert a byte array into a 2 byte per character Java String by adding a * 0-byte in front of each byte. * * @param data * the input byte array * @return the Java String */ public static String ASCIIByteArrayToString(byte[] data) { StringBuilder r = new StringBuilder(""); for (byte b : data) { r.append((char) (b & 0xFF)); } return r.toString(); } }