Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * new byte[] { 8, 4, 2, 1 }, 0, 4, 2 => new byte[][]{{8,4}, {2,1}}
     *
     * @param src
     * @param start
     * @param length
     * @param subArrayLength
     * @return
     */

    public static byte[][] getCopyByteArrayArray(byte[] src, int start, int length, int subArrayLength) {
        byte[][] dest = new byte[length / subArrayLength][subArrayLength];
        byte[] temp = new byte[length];
        System.arraycopy(src, start, temp, 0, length);
        for (int i = 0; i < dest.length; i++) {
            System.arraycopy(temp, i * subArrayLength, dest[i], 0, subArrayLength);
        }

        return dest;
    }
}