Java中short、int、long、float、double的取值範圍

來源:互聯網
上載者:User

標籤:height   java   style   e30   封裝   bit   bsp   最大   類型   


一、基礎資料型別 (Elementary Data Type)的特點,位元,最大值和最小值。
1、
基本類型:short 二進位位元:16
封裝類:java.lang.Short
最小值:Short.MIN_VALUE=-32768 (-2的15此方)
最大值:Short.MAX_VALUE=32767 (2的15次方-1)
2、
基本類型:int 二進位位元:32
封裝類:java.lang.Integer
最小值:Integer.MIN_VALUE= -2147483648 (-2的31次方)
最大值:Integer.MAX_VALUE= 2147483647  (2的31次方-1)
3、
基本類型:long 二進位位元:64
封裝類:java.lang.Long
最小值:Long.MIN_VALUE=-9223372036854775808 (-2的63次方)
最大值:Long.MAX_VALUE=9223372036854775807 (2的63次方-1)
4、
基本類型:float 二進位位元:32
封裝類:java.lang.Float
最小值:Float.MIN_VALUE=1.4E-45 (2的-149次方)
最大值:Float.MAX_VALUE=3.4028235E38 (2的128次方-1)
5、
基本類型:double 二進位位元:64
封裝類:java.lang.Double
最小值:Double.MIN_VALUE=4.9E-324 (2的-1074次方)
最大值:Double.MAX_VALUE=1.7976931348623157E308 (2的1024次方-1)

 

基本類型 位元組數 位元 最大值 最小值
byte 1byte 8bit 2^7 - 1 -2^7
short 2byte 16bit 2^15 - 1 -2^15
int 4byte 32bit 2^31 - 1 -2^31
long 8byte 64bit 2^63 - 1 -2^63
float 4byte 32bit 3.4028235E38 1.4E - 45
double 8byte 64bit 1.7976931348623157E308 4.9E - 324
char 2byte 16bit 2^16 - 1 0

Java中short、int、long、float、double的取值範圍

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.