Mp3dings 
20100427

de.mospace.lang
Class Array

java.lang.Object
  extended by de.mospace.lang.Array

public class Array
extends Object

Array utilities.

Version:
$Revision: 12 $ ($Date: 2007-07-27 11:48:53 +0200 (Fr, 27 Jul 2007) $)
Author:
Moritz Ringler

Method Summary
static String byteArrayToString(byte[] b)
          Converts a byte array to a Hex String.
static int[][] getIntervals(int[] numbers)
          Returns the continuous sequences of integers contained in the input array.
static String join(int[] arr, char delim)
          Joins the elements of an int array to a character-delimited String.
static String join(Object[] arr, char delim)
          Joins the elements of an Object array to a character-delimited String.
static double[] slice(double[] src, int begin, int length)
          Extracts a sub-array from a double array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

join

public static String join(Object[] arr,
                          char delim)
Joins the elements of an Object array to a character-delimited String. No warning will be issued if one of the array elements contains the delimiter.

Parameters:
arr - the array to join
delim - the delimiter to use
Returns:
a string made up of the string representations of the array elements separated by the delimiter character

join

public static String join(int[] arr,
                          char delim)
Joins the elements of an int array to a character-delimited String. No warning will be issued if one of the array elements contains the delimiter.

Parameters:
arr - the array to join
delim - the delimiter to use
Returns:
a string made up of the string representations of the array elements separated by the delimiter character

byteArrayToString

public static String byteArrayToString(byte[] b)
Converts a byte array to a Hex String.

Parameters:
b - a non-null byte array
Returns:
the input array as a sequence of Hex digits

getIntervals

public static int[][] getIntervals(int[] numbers)
Returns the continuous sequences of integers contained in the input array. The input array is sorted and for each continous sequence of integers that it contains a 2-element array made up of its lower and upper bounds is added to the result.

Parameters:
numbers - the set of integers to analyze
Returns:
null if numbers is null or empty. Otherwise an ordered array of pairs of integers, which are the lower and upper bounds of the continuous sequences of integers contained in the input.

slice

public static double[] slice(double[] src,
                             int begin,
                             int length)
Extracts a sub-array from a double array.

Parameters:
src - a non-null double array
begin - the start of the sub-array to extract
length - the length of the sub-array to extract
Returns:
a new double array {src[begin], ..., src[begin + length - 1]}

Mp3dings 
20100427