java int 类整数的最大值是 2 的 31 次方 - 1 = 2147483648 - 1 = 2147483647 可以用 Integer.MAX_VALUE 表示它,即 int value = Integer.MAX_VALUE; Integer.MAX_VALUE + 1 = Integer.MIN_VALUE = -2147483648 再大的数就要用 long (最大值 2 的 63 次方 - 1 )或者 BigDecimal 表示 Java 八种...
int max_value = Integer.MAX_VALUE;
Integer.MAX_VALUE 获取int类型的最大值 Integer.MIN_VALUE 获取int类型的最小值,其他基本数据类型同理
c++中int最大值是2^31-1=2147483647,java一样。获取程序运行时间:int start = clock();/*要获取运行时间的程序段*/int end = clock();运行时间为(end - start)秒
//获取数组中的最大值 class TestMax { public static void main(String[] args) { int a[]={1,5,3,12,2,99,12}; int max=getMax(a); System.out.println("最大值为:"+max); } public static int getMax(int[] arr){ int max=arr[0]; ...