at.tuwien.ifs.somtoolbox.util
Class ArrayUtils

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

public class ArrayUtils
extends Object

Class gathering utilities related to Arrays.

Version:
$Id: ArrayUtils.java 3651 2010-07-13 09:58:16Z mayer $
Author:
Rudolf Mayer

Constructor Summary
ArrayUtils()
           
 
Method Summary
static int countOccurrences(String s, String[] array)
          Counts the number of occurrences of the given string in the given array
static Double[] doubleToDoubleArray(double... a)
          Converts a double[] to a Double[] (auto-boxing doesn't work for arrays...)
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 String toString(int... a)
          A vararg wrapper around Arrays.toString(int[])
static 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 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 String toString(int... a)
A vararg wrapper around Arrays.toString(int[])


countOccurrences

public static int countOccurrences(String s,
                                   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 Double[] doubleToDoubleArray(double... a)
Converts a double[] to a Double[] (auto-boxing doesn't work for arrays...)