1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import org.aspectj.testing.Tester;
//Boundary base values can be parsed
public class BoundaryNums {
public static void main(String[] args) {
byte minByte = -128;
byte maxByte = 127;
byte minByteHex = -0x80;
byte maxByteHex = 0x7F;
Tester.checkEqual(minByte, Byte.MIN_VALUE);
Tester.checkEqual(maxByte, Byte.MAX_VALUE);
Tester.checkEqual(minByteHex, Byte.MIN_VALUE);
Tester.checkEqual(maxByteHex, Byte.MAX_VALUE);
short minShort = -32768;
short maxShort = 32767;
short minShortHex = -0x8000;
short maxShortHex = 0x7FFF;
Tester.checkEqual(minShort, Short.MIN_VALUE);
Tester.checkEqual(maxShort, Short.MAX_VALUE);
Tester.checkEqual(minShortHex, Short.MIN_VALUE);
Tester.checkEqual(maxShortHex, Short.MAX_VALUE);
char maxChar = 65535;
char maxCharHex = 0xffff;
char maxCharChar = '\uffff';
Tester.checkEqual(maxChar, Character.MAX_VALUE);
Tester.checkEqual(maxCharHex, Character.MAX_VALUE);
Tester.checkEqual(maxCharChar, Character.MAX_VALUE);
int minInt = -2147483648;
int maxInt = 2147483647;
int minIntHex = -0x80000000;
int maxIntHex = 0x7fffffff;
Tester.checkEqual(minInt, Integer.MIN_VALUE);
Tester.checkEqual(maxInt, Integer.MAX_VALUE);
Tester.checkEqual(minIntHex, Integer.MIN_VALUE);
Tester.checkEqual(maxIntHex, Integer.MAX_VALUE);
long minLong = -9223372036854775808L;
long maxLong = 9223372036854775807L;
long minLongHex = -0x8000000000000000L;
long maxLongHex = 0x7fffffffffffffffL;
Tester.checkEqual(minLong, Long.MIN_VALUE);
Tester.checkEqual(maxLong, Long.MAX_VALUE);
Tester.checkEqual(minLongHex, Long.MIN_VALUE);
Tester.checkEqual(maxLongHex, Long.MAX_VALUE);
float minPosFloat = 1.40239846e-45f;
float maxPosFloat = 3.40282347e+38f;
Tester.checkEqual(minPosFloat, Float.MIN_VALUE);
Tester.checkEqual(maxPosFloat, Float.MAX_VALUE);
double minPosDouble = 4.94065645841246544e-324;
double maxPosDouble = 1.79769313486231570e+308;
Tester.checkEqual(minPosDouble, Double.MIN_VALUE);
Tester.checkEqual(maxPosDouble, Double.MAX_VALUE);
}
}
|