1 2 24 25 26 27 28 29 package com.lutris.util; 30 31 39 public class BytesToString { 40 41 48 public static String conv(byte[] b) { 49 return conv(b, b.length); 50 } 51 52 53 61 public static String conv(byte[] b, int len) { 62 byte[] c = new byte[len]; 63 for(int i=0; i<len; i++) { 64 byte n = b[i]; 65 if ((n < 32) || (n > 128)) 66 n = 65; 67 c[i] = n; 68 } 69 return new String (c); 70 } 71 } 72 73 | Popular Tags |