JAVA [Integer]

        int i = Integer.MAX_VALUE;      //2147483647
        i = Integer.SIZE;               //32位
        i = Integer.MIN_VALUE;          //-2147483648
        i = Integer.bitCount(i);        //返回指定 int 值的二进制补码表示形式的 1 位的数量
        i = 19;                         // 0001 0011
        i = Integer.bitCount(i);        //3
//        parseInt("0", 10) 返回 0
//        parseInt("473", 10) 返回 473
//        parseInt("-0", 10) 返回 0
//        parseInt("-FF", 16) 返回 -255
//        parseInt("1100110", 2) 返回 102
//        parseInt("2147483647", 10) 返回 2147483647
//        parseInt("-2147483648", 10) 返回 -2147483648
//        parseInt("2147483648", 10) 抛出 NumberFormatException
//        parseInt("99", 8) 抛出 NumberFormatException
//        parseInt("Kona", 10) 抛出 NumberFormatException
//        parseInt("Kona", 27) 返回 411787
        i = Integer.valueOf("256",16);  //598
        
        String s;
        s = Integer.toBinaryString(19);      //10011 以二进制(基数 2)无符号整数形式返回一个整数参数的字符串表示形式
        s = Integer.toHexString(19);         //13 以十六进制(基数 16)无符号整数形式返回一个整数参数的字符串表示形式
        s = Integer.toOctalString(19);      //23 以八进制(基数 8)无符号整数形式返回一个整数参数的字符串表示形式
        s = Integer.toString(19);
//        i - 要转换成字符串的整数。
//        radix - 用于字符串表示形式的基数

        s = Integer.toString(19, 7);         //25
        
        i = Integer.decode("20");         //DecimalNumeral  20
        i = Integer.decode("0x20");       //HexDigits       32
        i = Integer.decode("0X20");       //
        i = Integer.decode("#20");        //
        i = Integer.decode("020");         //OctalDigits     16
        
        i = 19;
        i = Integer.rotateLeft(i, 3);     //10011000 152
        i = Integer.rotateRight(i, 3);
        
        i = Integer.reverse(i);           //返回通过反转指定 int 值的二进制补码表示形式中位的顺序而获得的值
        s = Integer.toBinaryString(i);    //11001000000000000000000000000000
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值