标签:算法 功能 sqrt long 类型 常用 -- max ring
1.数据类型及范围:
public class Test1 {
public static void main(String[] args) {
/* 八个变量 abcdefgh,
* 保存四种整数的最小值和最大值 */
byte a = -128;
byte b = 127;
/* jdk类库中的 Short 类
* 中的常量 MIN_VALUE */
short c = Short.MIN_VALUE;
short d = Short.MAX_VALUE;
int e = Integer.MIN_VALUE;
int f = Integer.MAX_VALUE;
long g = Long.MIN_VALUE;
long h = Long.MAX_VALUE;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(e);
System.out.println(f);
System.out.println(g);
System.out.println(h);
}
}
2.四个变量 abcd,
保存两个浮点数的最小值最大值
public class Test2 {
public static void main(String[] args) {
/*
* 四个变量 abcd,
* 保存两个浮点数的最小值最大值
*/
float a = Float.MIN_VALUE;
float b = Float.MAX_VALUE;
double c = Double.MIN_VALUE;
double d = Double.MAX_VALUE;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
}
}
3.CHAR 字符
public class Test4 {
public static void main(String[] args) {
int a = 0xff;
int b = 0377;
char c = ‘\u4e2d‘;
//Unicode中文字符范围 \u4e00到\u9fa5
char d = ‘\u4e00‘;
char e = ‘\u9fa5‘;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(e);
}
}
5.数据算法
public static void main(String[] args) {
System.out.println(3/2);
System.out.println(3d/2);
System.out.println("------------------------");
System.out.println("s"+"b");
System.out.println(‘s‘+‘b‘);//int+int
System.out.println(‘s‘+"b");
System.out.println("------------------------");
System.out.println(Integer.MAX_VALUE+1);
System.out.println(300000000*60*60*24*365);
System.out.println(300000000L*60*60*24*365);
System.out.println("------------------------");
System.out.println(2-1.9);
System.out.println(2-1.8);
System.out.println(2-1.7);
System.out.println(2-1.6);
System.out.println(2-1.5);
System.out.println(4.35*100);
System.out.println(4.36*100);
System.out.println(4.37*100);
System.out.println(4.38*100);
System.out.println(4.39*100);
System.out.println("------------------------");
System.out.println(3.14/0);
System.out.println(Double.MAX_VALUE*2);
System.out.println(Math.sqrt(-4));
}
标签:算法 功能 sqrt long 类型 常用 -- max ring
原文地址:https://www.cnblogs.com/robinAndLaurel/p/9798737.html