@Test public void testBytes2string() { Assert.assertEquals("", MD5.getInstance().bytes2string(new byte[0])); Assert.assertEquals("010203", MD5.getInstance().bytes2string(new byte[]{1, 2, 3})); }
public String bytes2string(byte[] bt) { int l = bt.length; char[] out = new char[l << 1]; for (int i = 0, j = 0; i < l; i++) { out[j++] = digits[(0xF0 & bt[i]) >>> 4]; out[j++] = digits[0x0F & bt[i]]; } return new String(out); }
MD5 { public String bytes2string(byte[] bt) { int l = bt.length; char[] out = new char[l << 1]; for (int i = 0, j = 0; i < l; i++) { out[j++] = digits[(0xF0 & bt[i]) >>> 4]; out[j++] = digits[0x0F & bt[i]]; } return new String(out); } }
MD5 { public String bytes2string(byte[] bt) { int l = bt.length; char[] out = new char[l << 1]; for (int i = 0, j = 0; i < l; i++) { out[j++] = digits[(0xF0 & bt[i]) >>> 4]; out[j++] = digits[0x0F & bt[i]]; } return new String(out); } private  MD5(); }
MD5 { public String bytes2string(byte[] bt) { int l = bt.length; char[] out = new char[l << 1]; for (int i = 0, j = 0; i < l; i++) { out[j++] = digits[(0xF0 & bt[i]) >>> 4]; out[j++] = digits[0x0F & bt[i]]; } return new String(out); } private  MD5(); static MD5 getInstance(); String getMD5String(String content); String getMD5String(byte[] content); byte[] getMD5Bytes(byte[] content); byte[] hash(String str); byte[] hash(byte[] data); String bytes2string(byte[] bt); }
MD5 { public String bytes2string(byte[] bt) { int l = bt.length; char[] out = new char[l << 1]; for (int i = 0, j = 0; i < l; i++) { out[j++] = digits[(0xF0 & bt[i]) >>> 4]; out[j++] = digits[0x0F & bt[i]]; } return new String(out); } private  MD5(); static MD5 getInstance(); String getMD5String(String content); String getMD5String(byte[] content); byte[] getMD5Bytes(byte[] content); byte[] hash(String str); byte[] hash(byte[] data); String bytes2string(byte[] bt);  }