-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.java
More file actions
59 lines (50 loc) · 948 Bytes
/
Utils.java
File metadata and controls
59 lines (50 loc) · 948 Bytes
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
public class Utils {
public static boolean isNumeric(String str) {
try {
Double.parseDouble(str);
return true;
} catch (NumberFormatException e) {
return false;
}
}
public static String reverse(String input) {
char[] in = input.toCharArray();
int begin = 0;
int end = in.length - 1;
char temp;
while (end > begin) {
temp = in[begin];
in[begin] = in[end];
in[end] = temp;
end--;
begin++;
}
return new String(in);
}
static byte[] reverseByteArray(byte a[], byte n) {
byte i, t;
for (i = 0; i < n / 2; i++) {
t = a[i];
a[i] = a[n - i - 1];
a[n - i - 1] = t;
}
return a;
}
public static byte findIndex(byte arr[], byte t) {
if (arr == null) {
return -1;
}
byte len = (byte) (arr.length);
byte i = 0;
while (i < len) {
if (arr[i] == t) {
return i;
} else {
i = (byte) (i + 1);
}
}
return -1;
}
public static void main(String[] args) {
}
}