Class ArrayUtils


  • public class ArrayUtils
    extends java.lang.Object
    Since:
    : 01.03.21
    Version:
    : 1.0
    Author:
    : Enrico Gamil Toros Project name : apt-decoder
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<double[]> chunkArray​(double[] array, int chunkSize)
      Splits an Array into N chunks.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArrayUtils

        public ArrayUtils()
    • Method Detail

      • chunkArray

        public static java.util.List<double[]> chunkArray​(double[] array,
                                                          int chunkSize)
        Splits an Array into N chunks.

        Example:

        double[] numbers = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0};

        double[][] chunks = chunkArray(numbers, 3);

        Chunks now contains: [[1, 2, 3], [4, 5, 6], [7]]

        Parameters:
        array - Original Array to be split
        chunkSize - Size of wanted chunks
        Returns:
        original array split into N chunks as List