at.tuwien.ifs.somtoolbox.util
Class ArrayUtils

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.util.ArrayUtils

public class ArrayUtils
extends java.lang.Object

Class gathering utilities related to Arrays.

Version:
$Id: ArrayUtils.java 4130 2011-02-08 12:52:29Z mayer $
Author:
Rudolf Mayer

Constructor Summary
ArrayUtils()
           
 
Method Summary
static int countOccurrences(java.lang.String s, java.lang.String[] array)
          Counts the number of occurrences of the given string in the given array
static java.lang.Double[] doubleToDoubleArray(double... a)
          Converts a double[] to a Double[] (auto-boxing doesn't work for arrays...)
static double[] findExtremes(double[] a)
          Returns the min and max values of the given array
static int getBinIndex(double value, double[] bins)
           
static int[] getLinearArray(int dim)
          Initialises an array of the given size, with the value at each index corresponding to the index, i.e.
static double[] getLinearPercentageArray()
          create a double[] which contains percentage values, i.e.
static java.lang.String toString(int... a)
          A vararg wrapper around Arrays.toString(int[])
static java.lang.String toString(int[] a, int maxValues)
          Gets a string representation just as Arrays.toString(int[]), but at most until the given max amount of values.
 
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

getLinearArray

public static int[] getLinearArray(int dim)
Initialises an array of the given size, with the value at each index corresponding to the index, i.e. 0, 1, 2, ....


toString

public static java.lang.String toString(int[] a,
                                        int maxValues)
Gets a string representation just as Arrays.toString(int[]), but at most until the given max amount of values.


toString

public static java.lang.String toString(int... a)
A vararg wrapper around Arrays.toString(int[])


countOccurrences

public static int countOccurrences(java.lang.String s,
                                   java.lang.String[] array)
Counts the number of occurrences of the given string in the given array


getBinIndex

public static int getBinIndex(double value,
                              double[] bins)

getLinearPercentageArray

public static double[] getLinearPercentageArray()
create a double[] which contains percentage values, i.e. the values from 0.01 to 1.0 with a step-size of 0.01


doubleToDoubleArray

public static java.lang.Double[] doubleToDoubleArray(double... a)
Converts a double[] to a Double[] (auto-boxing doesn't work for arrays...)


findExtremes

public static double[] findExtremes(double[] a)
Returns the min and max values of the given array