Android Array Split byteSplit(byte[] inp, int... splitLength)

Here you can find the source of byteSplit(byte[] inp, int... splitLength)

Description

byte Split

Declaration

public static final byte[][] byteSplit(byte[] inp, int... splitLength) 

Method Source Code

//package com.java2s;

public class Main {
    public static final byte[][] byteSplit(byte[] inp, int... splitLength) {
        if (inp == null || splitLength == null)
            return null;

        int position = 0;
        byte spilit_data[][] = new byte[splitLength.length][];
        for (int inx = 0; inx < splitLength.length; inx++) {
            spilit_data[inx] = new byte[splitLength[inx]];
            for (int jnx = 0; jnx < splitLength[inx]; jnx++) {
                try {
                    spilit_data[inx][jnx] = inp[position++];
                } catch (ArrayIndexOutOfBoundsException e) {
                    return null;
                }//  ww  w. ja v a  2 s.  c o  m
            }
        }

        return spilit_data;
    }
}

Related

  1. split(byte[] input)