-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
99 lines (91 loc) · 2.13 KB
/
Test.java
File metadata and controls
99 lines (91 loc) · 2.13 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package cn;
import java.nio.ByteBuffer;
public class Test {
static int x = 10;
static int b;
static {
x += 5;
}
private static int i = 100;
public static void main(String[] args) {
testInteger();
// Integer i01 = 59;
// int i02 = 59;
// Integer i03 = Integer.valueOf(59);
// try {
// } catch (RuntimeException e) {
// e.printStackTrace();
// }
// Integer i04 = new Integer(59);
// System.out.println(i01== i02);
// System.out.println(i01== i03);
// System.out.println(i03== i04);
// System.out.println(i02== i04);
/*Long l=233l;
byte[] bytesLong = longToBytes(l);
System.out.println(bytesToLong(bytesLong));
try {
test(new int[] { 0, 1, 2, 3, 4, 5 });
} catch (Exception e) {
System.out.print("E");
}
System.out.println(x);
boolean b = true ? false : true == true ? false : true;
System.out.println(b);
System.out.println(123.23 + 789.20);
double a = .3 - .2;
System.out.println(a);
double y = .2 - .1;
System.out.println(y);
double x = (.1 + .1 + .1);
System.out.println(x);
System.out.println(x == .3);*/
}
static {
x /= 3;
};
private static void test(int[] arr) {
for (int i = 0; i < arr.length; i++) {
try {
if (arr[i] % 2 == 0) {
throw new NullPointerException();
} else {
System.out.print(i);
}
} finally {
System.out.print("e");
}
}
}
/**
* byte[] Long
* @param b
* @return
* 2017-5-12 01:26:28
*/
private static ByteBuffer buffer = ByteBuffer.allocate(8);
public static Long bytesToLong(byte[] b){
buffer.put(b, 0, b.length);
buffer.flip();//need flip
return buffer.getLong();
}
public static byte[] longToBytes(long x) {
buffer.putLong(0, x);
return buffer.array();
}
/**
* byte[] String
* @param b
* @return
* 2017-5-12 01:26:28
*/
public static String test2(byte[] b){
return new String(b);
}
public static void testInteger(){
Integer i_1 = new Integer(1);
Integer i_2 = new Integer(1);
String str="";
System.out.println(i_1 == i_2);
}
}