stringutils.java
来自「很棒的web服务器源代码」· Java 代码 · 共 32 行
JAVA
32 行
// StringUtils.java// $Id: StringUtils.java,v 1.2 2000/08/16 21:37:58 ylafon Exp $// (c) COPYRIGHT MIT, INRIA and Keio, 1999.// Please first read the full copyright statement in file COPYRIGHT.htmlpackage org.w3c.util;public class StringUtils { /** * to hex converter */ private static final char[] toHex = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; /** * convert an array of bytes to an hexadecimal string * @param an array of bytes * @return a string */ public static String toHexString(byte b[]) { int pos = 0; char[] c = new char[b.length*2]; for (int i=0; i< b.length; i++) { c[pos++] = toHex[(b[i] >> 4) & 0x0F]; c[pos++] = toHex[b[i] & 0x0f]; } return new String(c); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?