forked from methoxid/mySight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.pde
44 lines (38 loc) · 1.25 KB
/
utils.pde
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
void printDataDigest(byte[] arr) {
int digestStartLength = 5;
int digestEndLength = 5;
int digestStartEndIndex = min(arr.length, digestStartLength);
int digestEndStartIndex = arr.length-(digestEndLength+HEADER_SIZE);
StringBuilder sb = new StringBuilder();
for (int i=0; i<digestStartEndIndex; i++) {
sb.append(String.valueOf(arr[i]));
sb.append(",");
}
if (digestEndStartIndex>=0 && digestEndStartIndex>digestStartEndIndex) {
sb.append("..., ");
for (int i=digestEndStartIndex; i<arr.length; i++) {
sb.append(String.valueOf(arr[i]));
sb.append(",");
}
}
println(sb.toString());
}
void printDataDigest(int[] arr) {
int digestStartLength = 5;
int digestEndLength = 5;
int digestStartEndIndex = min(arr.length, digestStartLength);
int digestEndStartIndex = arr.length-(digestEndLength+HEADER_SIZE);
StringBuilder sb = new StringBuilder();
for (int i=0; i<digestStartEndIndex; i++) {
sb.append(String.valueOf(arr[i]));
sb.append(",");
}
if (digestEndStartIndex>=0 && digestEndStartIndex>digestStartEndIndex) {
sb.append("..., ");
for (int i=digestEndStartIndex; i<arr.length; i++) {
sb.append(String.valueOf(arr[i]));
sb.append(",");
}
}
println(sb.toString());
}