Java Integer, Byte, Short, Long, Float, Double

创建: 2020/11/15

都immutable

https://docs.oracle.com/javase/jp/8/docs/api/constant-values.html

Integer
  int的wrap
构造函数
Integer(int i)  
Integer(String s) throws NumberFormatException  
静态变量
Integer.MAX_VALUE 231-1
Integer.MIN_VALUE -231
Integer.TYPE int类型
Integer.SIZE 比特长32
静态方法
字符串转int
static Integer decode(String s) throws NumberFormatException

分析数字,支持正负号。

加0为8进制

加0X,0x,#为16进制

static int parseInt(String s) throws NumberFormatException

static int parseInt(String s, int r) throws NumberFormatException

分析数字 

static Integer valueOf(String s) throws NumberFormatException

static Integer valueOf(String s, int r) throws NumberFormatException

分析数字

和parseInt()的区别: 返回Integer

   
补数 static int reverse(int i)

signum

static int signum(int i)
转为字符串

 

2进制 static String toBinaryString(int i)
8进制 static String toOctalString(int i)
16进制 static String toHexString()

 

   
   
   
实例方法

 

转型

 

byte byteValue()  
double doubleValue()  
float floatValue()  
int intValue()  
long longValue()  
short shortValue()  
String toString() 转为字符串
是否相等 boolean equals(Object obj)

 

 

   
Boolean
静态变量  
Boolean.TRUE  
Boolean.FALSE  
Boolean.TYPE  
构造函数
Boolean(boolean b)  
Boolean(String s) s为true或false字符串
静态函数 
转字符串
static boolean getBoolean(String s)  
static boolean valueOf(String)  
static boolean parseBoolean(String s)  
   
实例函数

 

boolean booleanValue()  
   

 

Character
静态变量
MAX_VALUE 65535
MIN_VALUE 0
SIZE 16
TYPE  
构造函数 Character(char c)
静态函数   
判断
static boolean isDefined(char c) 是否在Unicode里有定义
static boolean isDigit(char c) 是否是数字
static boolean isISOControl(char c)

是否是ISO控制文字

???

static boolean isLetter(char c) 是否是字母
static boolean isLetterorDigit(char c) 是否是字母或数字
static boolean isLowerCase(char c) 是否是小写
static boolean isUpperCase(char c) 是否是大写
static boolean isSpaceChar(char c) 是否是space
static boolean isWhiteSpace(char c)

是否是white space

space, tab, or new line

   
大小写转换
static char toLowerCase(char c) 小写
static char toUpperCase(char c) 大写

 

实例函数   
char charValue() 获取自身的char

 

 

Byte
静态变量
Byte.MAX_VALUE 127
Byte.MIN_VALUE -128
Byte.SIZE 8
Byte.Type  
构造函数  
Byte(byte b)  
Byte(String s) throws NumbersFormatException  
静态函数   
字符串转byte
static Byte decode(String s) throws NumberFormatException  

static byte parseByte(String s) throws NumberFormatException

static byte parseByte(String s, int radix) throws NumberFormatException

返回byte

static Byte valueOf(String s) throws NumberFormatException

static Byte valueOf(String s, int radix) throws NumberFormatException

 
   
实例函数   
转型
byte byteValue()  
double doubleValue()  
float floatValue()  
int intValue()  
long longValue()  
short shortValue()  
String toString()  
   
   
Short
静态变量
MAX_VALUE 32767
MIN_VALUE -32768
SIZE 16
TYPE  
构造函数
Short(short s)  
Short(String) throws NumberFormatException  
静态函数   
字符串转short
static Short decode(String s) throws NumberFormatException  

static short parseShort(String s) throws NumberFormatException

static short parseShort(String s, int radix) throws NumberFormatException

返回short

static Short valueOf(String s) throws NumberFormatException

static Short valueOf(String s, int radix) throws NumberFormatException

 
   
实例函数  
转型
byte byteValue()  
double doubleValue()  
float floatValue()  
int intValue()  
long longValue()  
short shortValue()  
String toString()  
   
   
   
Long
静态变量
MAX_VALUE 263-1
MIN_VALUE -263
SIZE 64
TYPE  
构造函数
Long(long l)  
Long(String s) throws NumberFormatException  
 
静态函数   
字符串转Long
static Long decode(String s) throws NumberFormatException  

static long parseLong(String s) throws NumberFormatException

static long parseLong(String s, int radix) throws NumberFormatException

返回long

static Long valueOf(String s) throws NumberFormatException

static Long valueOf(String s, int radix) throws NumberFormatException

 
补数 static int reverse(long l)
signum static int reverse(long l)
转文字
static String toBinaryString(long i)  
static String toHexString(long l)  
static String toOctalString(long l)  
static String toString(long l) decimal
实例函数  
转型
byte byteValue()  
double doubleValue()  
float floatValue()  
int intValue()  
long longValue()  
short shortValue()  
String toString()  
   
Float
静态变量

MAX_VALUE

MIN_VALUE

 
POSITIVE_INFINITE
NEGATIVE_INFINITE
 

MAX_EXPONENT

MIN_EXPONENT

127

-126 

MIN_NORMAL

 

NAN

最小正值2-126
SIZE 32
TYPE  
构造函数  

Float(float f)

Float(double d)

 
Float(String s) throws NumberFormatException  
静态函数  
字符串转float
static float parseFloat(String s) throws NumberFormatException 返回float
static Float valueOf(String s) throws NumberFormatException  
判断
static boolean isInfinite(float f)  
static boolean isNaN(float)  
转为字符串
static String toString(float f)  

实例函数

 

转型
byte byteValue()  
double doubleValue()  
float floatValue()  
int intValue()  
long longValue()  
short shortValue()  
String toString()  
判断
boolean isInfinite()  
boolean isNaN()  
Double
静态变量

MAX_VALUE

MIN_VALUE

 

POSITIVE_INFINITE

NEGATIVE_INFINITE

 

MAX_EXPONENT

MIN_EXPONENT

1023

-1022 

MIN_NORMAL 最小正数(2-1022)
NAN  
SIZE  64
TYPE   
构造函数  

Double(double d)

 
Double(String s) throws NumberFormatException  
静态函数   
字符串转double
static double parseDouble(String s) throws NumberFormatException 返回double
static Double valueOf(String s) throws NumberFormatException  
判断
static boolean isInfinite(double d)  
static boolean isNaN(double d)  
转字符串
static String toString(double d)  
   
实例函数  
转型
byte byteValue()  
double doubleValue()  
float floatValue()  
int intValue()  
long longValue()  
short shortValue()  
String toString()  
   
判断
boolean isInfinite()  
boolean isNaN()  
   
   
posted @ 2020-11-15 20:45  懒虫哥哥  阅读(190)  评论(0编辑  收藏  举报