您现在的位置是:主页 > news > 备案 通过后 网站打不开/搜索引擎营销例子

备案 通过后 网站打不开/搜索引擎营销例子

admin2025/4/24 7:36:44news

简介备案 通过后 网站打不开,搜索引擎营销例子,公司的个人网站怎么做,怎么做网站代拍010300010001D5CA 有时候,我们需要把一段字符串转换成相应的byte[],java给我了我们操作方式byte.parsebyte,例如下面 byte b new Byte("01"); byte c Byte.parseByte("11", 16); 前2个都没有问题,但是如何这个数是大于0x8x&…

备案 通过后 网站打不开,搜索引擎营销例子,公司的个人网站怎么做,怎么做网站代拍010300010001D5CA 有时候,我们需要把一段字符串转换成相应的byte[],java给我了我们操作方式byte.parsebyte,例如下面 byte b new Byte("01"); byte c Byte.parseByte("11", 16); 前2个都没有问题,但是如何这个数是大于0x8x&…

010300010001D5CA

有时候,我们需要把一段字符串转换成相应的byte[],java给我了我们操作方式byte.parsebyte,例如下面

byte b = new Byte("01");
byte c = Byte.parseByte("11", 16);

前2个都没有问题,但是如何这个数是大于0x8x(不能大于127)就会有问题

byte f = Byte.parseByte("D5", 16);会报下面错误,原因就是大于了127

java.lang.NumberFormatException: Value out of range. Value:"D5" Radix:16
因此我们需要使用下面的方法,先转成integer,然后byteValue(),例如下面

  byte a = Integer.valueOf("D5", 16).byteValue();


public  String printHexString(byte b){
         String hex = Integer.toHexString(b & 0xFF);
         if (hex.length() == 1) {
             hex = '0' + hex;
         }
         return hex.toUpperCase();
    }


public  String printHexString( byte[] b) {
        String strHex = "";
        for (int i = 0; i < b.length; i++) {
            String hex = Integer.toHexString(b[i] & 0xFF);
            if (hex.length() == 1) {
                hex = '0' + hex;
            }
            System.out.print(hex.toUpperCase() + " ");
            strHex+=hex.toUpperCase() + " ";
        }
        System.out.println("");
        return strHex;
    }