/** * Hex格式数据转换成十六进制字符串 * @param src */ public void bytesToHexString(byte[] by){ StringBuilder stringBuilder = new StringBuilder(""); for (int i = 0; i < by.length; i++) { int in = by[i] & 0xFF; String str= Integer.toHexString(in); if (st
科普下颜色代码 RGB格式:220,20,60(三个数字组成) HEX格式:#DC143C 代码如下 var rgb = '220,20,60'; alert(rgb2hex(rgb)); //将RGB转换成#HEX function rgb2hex(rgb) { var reg=/(\d{1,3}),(\d{1,3}),(\d{1,3})/; var arr=reg.exec(rgb); function hex(x) { return ("0" + parseInt(x).toSt