/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test.util; /** * * @author Administrator */ public class StringUtil { public StringUtil() { } /** * 将指定byte数组以16进制的形式打印到控制台 * @param hint String
public class ArrayTest3 { public static void main(String[] args){ System.out.println(toHex(60)); } //将十进制转为16进制 public static String toHex(int num){ char[] chs = new char[8];//定义容器,存储的是字符,长度为8.一个整数最多8个16进制数 int index = chs.length-1; for(int i = 0;i<8
//将byte[]转换为16进制字符串 public static String byte2hex(byte[] b) { StringBuilder hs = new StringBuilder(); String stmp; for (int n = 0; b != null && n < b.length; n++) { stmp = Integer.toHexString(b[n] & 0XFF); if (stmp.length() == 1) hs.append(
public class Main { public static void main(String []args) { Main main = new Main(); System.out.println("main: "+main.Hex(j)); System.out.println("Sys: "+Integer.toHexString(j)); } private String Hex(int i) { String string=""
把字符串数组转换为16进制字符串 import java.security.MessageDigest; public class StringUtil { public StringUtil() { super(); } public static String str; public static final String EMPTY_STRING = ""; private final static String[] hexDigits = { "0", &q