Here you can find the source of toASCIIString(byte[] data)
Parameter | Description |
---|---|
data | a parameter |
public static String toASCIIString(byte[] data)
//package com.java2s; public class Main { /**//from ww w .j ava 2 s. c o m * Produces a string using each byte as an ASCII character * @param data * @return */ public static String toASCIIString(byte[] data) { if (data == null) { return null; } // TODO: write more efficient implementation String s = ""; for (int i = 0; i < data.length; i++) { char b = (char) data[i]; // if ( (b >= 0) && (b < 16) ) // { // s = s + "0"; // } s = s + b; } return s; } }