JAVA various numeric types maximum and minimum values Int, short, char, long, Float,&nbs

Source: Internet
Author: User
Tags float max

Code snippet:

byte Bmax, bmin;

Short Shmax, shmin;

Char Cmax, cmin;

int IMAX, imin;

Long lmax,lmin;

float fmax,fmin;

Double dmax,dmin;

Fmax = Float.max_value;

Fmin = Float.min_value;

DMax = Double.max_value;

DMin = Double.min_value;

Bmax = Byte.max_value;

Bmin = Byte.min_value;

Cmax = Character.max_value;

Cmin = Character.min_value;

Shmax = Short.max_value;

Shmin = Short.min_value;

IMAX = Integer.max_value;

Imin = Integer.min_value;

Lmax = Long.max_value;

Lmin = Long.min_value;

System.out.println ("float max=" +fmax);

System.out.println ("float min=" +fmin);

System.out.println ("Double max=" +dmax);

System.out.println ("Double max=" +dmin);

System.out.println ("Byte max=" +bmax);

System.out.println ("Byte min=" +bmin);

System.out.println ("char max=" +cmax);

System.out.println ("char min=" +cmin);

System.out.println ("Short max=" +shmax);

System.out.println ("Short min=" +shmin);

SYSTEM.OUT.PRINTLN ("int max=" +imax);

SYSTEM.OUT.PRINTLN ("int min=" +imin);

System.out.println ("Long max=" +lmax);

System.out.println ("Long min=" +lmin);

Output:

Float Max=3.4028235e38

Float min=1.4e-45

Double max=1.7976931348623157e308

Double max=4.9e-324

BYTE max=127

BYTE min=-128

Char max=?

Char min=

Short max=32767

Short min=-32768

int max=2147483647

int min=-2147483648

Long max=9223372036854775807

Long min=-9223372036854775808

Description

is actually the constant defined for each type of container class.

JAVA various numeric types maximum and minimum values Int, short, char, long, Float,&nbs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.