Here you can find the source of concat(float[] A, float[] B)
Parameter | Description |
---|---|
A | first array |
B | second array |
public static float[] concat(float[] A, float[] B)
//package com.java2s; /*//from www . j a va2 s .c o m * Copyright (c) 2008-2013 Maksim Khadkevich and Fondazione Bruno Kessler. * * This file is part of MART. * MART is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published * by the Free Software Foundation. * * MART is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with MART; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.List; public class Main { /** * Concatenates two arrays into one * * @param A first array * @param B second array * @return concatenated array */ public static float[] concat(float[] A, float[] B) { float[] C = new float[A.length + B.length]; System.arraycopy(A, 0, C, 0, A.length); System.arraycopy(B, 0, C, A.length, B.length); return C; } public static short[] concat(short[] A, short[] B) { short[] C = new short[A.length + B.length]; System.arraycopy(A, 0, C, 0, A.length); System.arraycopy(B, 0, C, A.length, B.length); return C; } public static int[] concat(int[] A, int[] B) { int[] C = new int[A.length + B.length]; System.arraycopy(A, 0, C, 0, A.length); System.arraycopy(B, 0, C, A.length, B.length); return C; } /** * Concatenates two arrays into one * * @param A first array * @param B second array * @return concatenated array */ 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; } /** * Concatenates 2d arrays * * @return */ public static float[] concat(List<float[]> inputs) { int numberOfFrames = 0; for (float[] anInput : inputs) { numberOfFrames += anInput.length; } float[] output = new float[numberOfFrames]; int pointer = 0; for (float[] anInput : inputs) { for (float anAnInput : anInput) { output[pointer++] = anAnInput; } } return output; } }