ArrayHelper
parent
bd9472b39b
commit
0ad56d00ff
|
@ -0,0 +1,38 @@
|
||||||
|
package org.hwo;
|
||||||
|
|
||||||
|
public class ArrayHelper {
|
||||||
|
|
||||||
|
|
||||||
|
public static Integer[] box(int[] a){
|
||||||
|
Integer[] r = new Integer[ a.length];
|
||||||
|
for (int i=0;i<a.length;i++){
|
||||||
|
r[i] = a[i];
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
public static int[] unbox(Integer[] a){
|
||||||
|
int[] r = new int[ a.length];
|
||||||
|
for (int i=0;i<a.length;i++){
|
||||||
|
r[i] = a[i];
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] unbox(Byte[] bytes){
|
||||||
|
byte[] t = new byte[ bytes.length ];
|
||||||
|
|
||||||
|
for (int i=0;i<t.length;i++)
|
||||||
|
t[i] = bytes[i];
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Byte[] box(byte[] bytes){
|
||||||
|
Byte[] t = new Byte[ bytes.length ];
|
||||||
|
|
||||||
|
for (int i=0;i<t.length;i++)
|
||||||
|
t[i] = bytes[i];
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,28 +1,6 @@
|
||||||
package org.hwo;
|
package org.hwo;
|
||||||
|
|
||||||
public class ByteArrayHelper {
|
public class ByteArrayHelper extends ArrayHelper{
|
||||||
|
|
||||||
public ByteArrayHelper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static byte[] unbox(Byte[] bytes){
|
|
||||||
byte[] t = new byte[ bytes.length ];
|
|
||||||
|
|
||||||
for (int i=0;i<t.length;i++)
|
|
||||||
t[i] = bytes[i];
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Byte[] box(byte[] bytes){
|
|
||||||
Byte[] t = new Byte[ bytes.length ];
|
|
||||||
|
|
||||||
for (int i=0;i<t.length;i++)
|
|
||||||
t[i] = bytes[i];
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue