자바 DataRange 프로젝트

자바 DataRange 프로젝트

1 DataRangeMain.java[ | ]

package datarange;

public class DataRangeMain {
	public static void main(String[] args) {
		byte byte_min = Byte.MIN_VALUE;
		byte byte_max = Byte.MAX_VALUE;
		short short_min = Short.MIN_VALUE;
		short short_max = Short.MAX_VALUE;
		int int_min = Integer.MIN_VALUE;
		int int_max = Integer.MAX_VALUE;
		long long_min = Long.MIN_VALUE;
		long long_max = Long.MAX_VALUE;
		char char_min = Character.MIN_VALUE;
		char char_max = Character.MAX_VALUE;
		float float_min = Float.MIN_VALUE;
		float float_max = Float.MAX_VALUE;
		double double_min = Double.MIN_VALUE;
		double double_max = Double.MAX_VALUE;

		System.out.println("byte : " + byte_min + " ~ " + byte_max);
		System.out.println("short : " + short_min + " ~ " + short_max);
		System.out.println("int : " + int_min + " ~ " + int_max);
		System.out.println("long : " + long_min + " ~ " + long_max);
		System.out.println("char : " + (int)char_min + " ~ " + (int)char_max);
		System.out.println("float : " + float_min + " ~ " + float_max);
		System.out.println("double : " + double_min + " ~ " + double_max);
	}
}

2 실행결과[ | ]

byte : -128 ~ 127
short : -32768 ~ 32767
int : -2147483648 ~ 2147483647
long : -9223372036854775808 ~ 9223372036854775807
char : 0 ~ 65535
float : 1.4E-45 ~ 3.4028235E38
double : 4.9E-324 ~ 1.7976931348623157E308
→ float, double은 MIN_VALUE가 최소값이 아니라 0에 가장 가까운 값이다.[1]
→ float: [math]\displaystyle{ 1.4\times10^{-45} }[/math] ~ [math]\displaystyle{ 3.4028235\times10^{38} }[/math]
→ double: [math]\displaystyle{ 4.9\times10^{-324} }[/math] ~ [math]\displaystyle{ 1.7976931348623157\times10^{308} }[/math]

3 같이 보기[ | ]

4 주석[ | ]

  1. 실제 최소값은 -1 × MAX_VALUE
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}