List of usage examples for java.lang System arraycopy
@HotSpotIntrinsicCandidate public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);
From source file:Main.java
public static byte[] concat(byte[] a, byte[] b) { byte[] c = new byte[a.length + b.length]; System.arraycopy(a, 0, c, 0, a.length); System.arraycopy(b, 0, c, a.length, b.length); return c;/*from ww w . j a va 2s. c o m*/ }
From source file:Main.java
public static void set4fArray(float[] destination, float[] source) { System.arraycopy(source, 0, destination, 0, 4); }
From source file:Main.java
public static byte[] get(byte[] array, int offset, int length) { byte[] result = new byte[length]; System.arraycopy(array, offset, result, 0, length); return result; }
From source file:Main.java
public static void copyBinaryArray(byte[][] src, byte[][] dest) { for (int i = 0; i < 8; i++) { System.arraycopy(src[i], 0, dest[i], 0, 8); }//from w w w .ja va 2s .c o m }
From source file:Main.java
public static byte[] join(byte[] src, byte[] des) { byte[] result = new byte[src.length + des.length]; System.arraycopy(src, 0, result, 0, src.length); System.arraycopy(des, 0, result, src.length, des.length); return result; }
From source file:Main.java
public static byte[] extractByteArray(byte[] body, int start, int length) { byte[] a = new byte[length]; System.arraycopy(body, start, a, 0, length); return a;/*w w w . j a v a2 s . com*/ }
From source file:Main.java
public static byte[] bytes2Bytes(byte[] b1, byte[] b2) { byte[] ret = new byte[b1.length + b2.length]; System.arraycopy(b1, 0, ret, 0, b1.length); System.arraycopy(b2, 0, ret, b1.length, b2.length); return ret;// www . j av a 2 s .co m }
From source file:Main.java
public static byte[] getCopyByteArray(byte[] src, int start, int length) { byte[] dest = new byte[length]; System.arraycopy(src, start, dest, 0, length); return dest;/*from ww w.jav a 2 s . c om*/ }
From source file:Main.java
public static byte[] arrayApend(byte[] prep, byte after) { byte[] result = new byte[prep.length + 1]; System.arraycopy(prep, 0, result, 0, prep.length); result[prep.length] = after;//www . java 2s . co m return result; }
From source file:Main.java
public static int[] insert(int[] array, int pos, int value) { int[] newArray = new int[array.length + 1]; System.arraycopy(array, 0, newArray, 0, pos); newArray[pos] = value;/*from w ww. ja v a2 s . c om*/ System.arraycopy(array, pos, newArray, pos + 1, array.length - pos); return newArray; }