Java tutorial
//package com.java2s; public class Main { public static void flatten_3D_vector(float[][][] src_vec, float[] target_vec) { int depth = src_vec.length; int height = src_vec[0].length; int width = src_vec[0][0].length; for (int i = 0; i < depth; i++) { for (int j = 0; j < height; j++) { System.arraycopy(src_vec[i][j], 0, target_vec, (i * height + j) * width, width); } } } }