在线转化:http://www.binaryconvert.com import java.text.DecimalFormat; public class SinglePrecision { //浮点到二进制 public String Float2Binary(double n) {//使用double输入,不影响 int signBit;//符号位 // String s = Float.toString((float) n); 这个方法会自动用 科学记数法4.52E-4 String s
static final char[] HEX_CHARS = "0123456789abcdef".toCharArray(); //转换为十六进制 public static String toHexString(byte[] b ) { StringBuilder sb = new StringBuilder(b.length << 2); for (byte x : b) { //byte只有8位 int 则是32位 x& oxff之后会转换为int类型 i