@Test public void testConcatAllDouble() { double[] alpha = {1, 2, 3}; double[] beta = {4, 5, 6}; double[] gamma = {7, 8, 9}; double[] expected = {1, 2, 3, 4, 5, 6, 7, 8, 9}; double[] result = ArrayUtils.concatAllDouble(alpha, beta, gamma); assertTrue(Arrays.equals(expected, result)); }
public static double[] concatAllDouble(double[] ... arrays) { int totalLength = 0; final int subArrayCount = arrays.length; for (int i = 0; i < subArrayCount; ++i) { totalLength += arrays[i].length; } double[] result = Arrays.copyOf(arrays[0], totalLength); int offset = arrays[0].length; for (int i = 1; i < subArrayCount; ++i) { System.arraycopy(arrays[i], 0, result, offset, arrays[i].length); offset += arrays[i].length; } return result; }
ArrayUtils { public static double[] concatAllDouble(double[] ... arrays) { int totalLength = 0; final int subArrayCount = arrays.length; for (int i = 0; i < subArrayCount; ++i) { totalLength += arrays[i].length; } double[] result = Arrays.copyOf(arrays[0], totalLength); int offset = arrays[0].length; for (int i = 1; i < subArrayCount; ++i) { System.arraycopy(arrays[i], 0, result, offset, arrays[i].length); offset += arrays[i].length; } return result; } }
ArrayUtils { public static double[] concatAllDouble(double[] ... arrays) { int totalLength = 0; final int subArrayCount = arrays.length; for (int i = 0; i < subArrayCount; ++i) { totalLength += arrays[i].length; } double[] result = Arrays.copyOf(arrays[0], totalLength); int offset = arrays[0].length; for (int i = 1; i < subArrayCount; ++i) { System.arraycopy(arrays[i], 0, result, offset, arrays[i].length); offset += arrays[i].length; } return result; }  }
ArrayUtils { public static double[] concatAllDouble(double[] ... arrays) { int totalLength = 0; final int subArrayCount = arrays.length; for (int i = 0; i < subArrayCount; ++i) { totalLength += arrays[i].length; } double[] result = Arrays.copyOf(arrays[0], totalLength); int offset = arrays[0].length; for (int i = 1; i < subArrayCount; ++i) { System.arraycopy(arrays[i], 0, result, offset, arrays[i].length); offset += arrays[i].length; } return result; }  static float[] convertDoublesToFloats(double[] input, float[] output); static float[] convertDoublesToFloats(double[] input); static double[] convertFloatsToDoubles(float[] input, double[] output); static double[] convertFloatsToDoubles(float[] input); static double[] concatAllDouble(double[] ... arrays); static float[] concatAllFloat(float[] ... arrays); static int[] concatAllInt(int[] ... arrays); static double[] getDoubleArrayFromBuffer(DoubleBuffer buffer); static float[] getFloatArrayFromBuffer(FloatBuffer buffer); static int[] getIntArrayFromBuffer(Buffer buffer); }
ArrayUtils { public static double[] concatAllDouble(double[] ... arrays) { int totalLength = 0; final int subArrayCount = arrays.length; for (int i = 0; i < subArrayCount; ++i) { totalLength += arrays[i].length; } double[] result = Arrays.copyOf(arrays[0], totalLength); int offset = arrays[0].length; for (int i = 1; i < subArrayCount; ++i) { System.arraycopy(arrays[i], 0, result, offset, arrays[i].length); offset += arrays[i].length; } return result; }  static float[] convertDoublesToFloats(double[] input, float[] output); static float[] convertDoublesToFloats(double[] input); static double[] convertFloatsToDoubles(float[] input, double[] output); static double[] convertFloatsToDoubles(float[] input); static double[] concatAllDouble(double[] ... arrays); static float[] concatAllFloat(float[] ... arrays); static int[] concatAllInt(int[] ... arrays); static double[] getDoubleArrayFromBuffer(DoubleBuffer buffer); static float[] getFloatArrayFromBuffer(FloatBuffer buffer); static int[] getIntArrayFromBuffer(Buffer buffer);  }