Here you can find the source of toText(byte[] arr)
Parameter | Description |
---|---|
arr | a parameter |
public static String toText(byte[] arr)
//package com.java2s; public class Main { /**/*from w ww . ja v a 2s . co m*/ * To text? * @param arr * @return */ public static String toText(byte[] arr) { String ret = ""; if (arr != null && arr.length > 0) { for (int i = 0; i < arr.length; i++) { if (i > 0) { ret += "."; } int b = toUnsignedInteger(arr[i]); ret += b; } } return ret; } /** * Convert byte to unsigned integer. * @param b * @return */ public static int toUnsignedInteger(byte b) { int n = b >= 0 ? b : b + 256; return n; } }