Java Array From arrayFromArrayWithLength(final byte[] array, final int length)

Here you can find the source of arrayFromArrayWithLength(final byte[] array, final int length)

Description

array From Array With Length

License

Apache License

Declaration

public static byte[] arrayFromArrayWithLength(final byte[] array, final int length) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] arrayFromArrayWithLength(final byte[] array, final int length) {
        final byte[] output = new byte[length];
        for (int j = 0; j < length; j++) {
            output[j] = array[(j % array.length)];
        }/*  ww  w  .  j  a va 2s  .  co  m*/
        return output;
    }
}

Related

  1. arrayFromIndex(double[][] values, int index)
  2. arrayFromList(String aList)
  3. arrayFromString(String fromString)
  4. arrayFromString(String s)