Integer包装类的重要方法
2017-03-25 12:26
253 查看
parseInt
public static int parseInt(String s, int radix)throws NumberFormatException public static int parseInt(String s) throws NumberFormatException
查阅JDK源码可以发现该函数的作用是把字符串转换成Int类型的整数
输入要求:
字符串不能为空;不能输入一位只包含正负号的字符串;除开第一位,其余位只能是数字
radix是进制数,默认是10,要求大于2且小于36
valueof
public static Integer valueOf(int i) public static Integer valueOf(String s, int radix) throws NumberFormatException public static Integer valueOf(String s) throws NumberFormatException这个函数的作用是把输入字符串、int整型转换成指定进制的Integer类型
intValue
Integer a = new Integer(3); a.intValue(); public int intValue() { return value; }该函数的作用是把Integer对象转换成int
toBinarySting
返回int的二进制表示System.out.println(Integer.toBinaryString(-7)); 11111111111111111111111111111001写出Integer类中的toBinaryString()方法
相关文章推荐
- Integer等包装类及String类的对比 ==与equals()方法的机制与不同
- Integer包装类常用方法
- Java基础知识强化65:基本类型包装类之Integer的构造方法
- Java利用反射来获取一个方法的 范型化参数 Vector<Integer>的类型
- 常见对象_Integer的构造方法
- 关于Integer的parseInt(String s, int radix)方法的使用
- iPhone导航控制器的重要“方法”
- Java Integer 之 n进制表示方法
- Integer中的valueOf方法和parseInt方法
- 【iOS开发-58】tableView初识:5个重要方法的使用和2种样式的区别
- SQLite3中自增主键相关知识总结,清零的方法、INTEGER PRIMARY KEY AUTOINCREMENT和rowid的使用
- 笛卡尔积、除、(外)连接等重要关系代数求解方法 概述
- java求integer位数的巧妙方法
- DHTML中重要的属性方法 (献给DHTML初学者)
- 重要方法(未完)
- Delphi控制Excel的重要属性和方法
- HTTP Servlet 重要的几个方法
- # include <errno.h >查看错误代码errno是调试程序的一个重要方法。当Linux C API函数发生异常时,一般会将errno变量赋值一个整数,不同的值表示不同的含义,可以通过查看
- 【iOS自动约束】四个重要的系统方法
- Integer.parseInt(String s ,int radix)方法使用解释