Package de.gsi.math
Class ArrayConversion
- java.lang.Object
-
- de.gsi.math.ArrayConversion
-
public final class ArrayConversion extends java.lang.ObjectThis utility class converts arrays of frequently used java primitives into other the requested primitive type. For the time being only 'Number' primitives are implemented, e.g. double array to float array etc. NOTE: USE WITH CARE! Keep in mind that these routines are based on creating new arrays and copying the old data. Consider re-implementing the analysis routines where necessary. Also, apologies for the largely redundant code: this is due to the lack of java template mechanism (generics) handling of primitive types. A hoorray to C++ templates!- Author:
- rstein
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getByteArray(byte[] in)returns a type-converted copy of the input vectorstatic byte[]getByteArray(double[] in)returns a type-converted copy of the input vectorstatic byte[]getByteArray(float[] in)returns a type-converted copy of the input vectorstatic byte[]getByteArray(int[] in)returns a type-converted copy of the input vectorstatic byte[]getByteArray(long[] in)returns a type-converted copy of the input vectorstatic byte[]getByteArray(short[] in)returns a type-converted copy of the input vectorstatic double[][]getDouble2DArray(float[][] in)returns a type-converted copy of the input matrixstatic double[]getDoubleArray(byte[] in)returns a type-converted copy of the input vectorstatic double[]getDoubleArray(double[] in)returns a type-converted copy of the input vectorstatic double[]getDoubleArray(float[] in)returns a type-converted copy of the input vectorstatic double[]getDoubleArray(int[] in)returns a type-converted copy of the input vectorstatic double[]getDoubleArray(long[] in)returns a type-converted copy of the input vectorstatic double[]getDoubleArray(short[] in)returns a type-converted copy of the input vectorstatic float[][]getFloat2DArray(double[][] in)returns a type-converted copy of the input matrixstatic float[]getFloatArray(byte[] in)returns a type-converted copy of the input vectorstatic float[]getFloatArray(double[] in)returns a type-converted copy of the input vectorstatic float[]getFloatArray(float[] in)returns a type-converted copy of the input vectorstatic float[]getFloatArray(int[] in)returns a type-converted copy of the input vectorstatic float[]getFloatArray(long[] in)returns a type-converted copy of the input vectorstatic float[]getFloatArray(short[] in)returns a type-converted copy of the input vectorstatic int[]getIntegerArray(byte[] in)returns a type-converted copy of the input vectorstatic int[]getIntegerArray(double[] in)returns a type-converted copy of the input vectorstatic int[]getIntegerArray(float[] in)returns a type-converted copy of the input vectorstatic int[]getIntegerArray(int[] in)returns a type-converted copy of the input vectorstatic int[]getIntegerArray(long[] in)returns a type-converted copy of the input vectorstatic int[]getIntegerArray(short[] in)returns a type-converted copy of the input vectorstatic long[]getLongArray(byte[] in)returns a type-converted copy of the input vectorstatic long[]getLongArray(double[] in)returns a type-converted copy of the input vectorstatic long[]getLongArray(float[] in)returns a type-converted copy of the input vectorstatic long[]getLongArray(int[] in)returns a type-converted copy of the input vectorstatic long[]getLongArray(long[] in)returns a type-converted copy of the input vectorstatic long[]getLongArray(short[] in)returns a type-converted copy of the input vectorstatic short[]getShortArray(byte[] in)returns a type-converted copy of the input vectorstatic short[]getShortArray(double[] in)returns a type-converted copy of the input vectorstatic short[]getShortArray(float[] in)returns a type-converted copy of the input vectorstatic short[]getShortArray(int[] in)returns a type-converted copy of the input vectorstatic short[]getShortArray(long[] in)returns a type-converted copy of the input vectorstatic short[]getShortArray(short[] in)returns a type-converted copy of the input vector
-
-
-
Method Detail
-
getByteArray
public static byte[] getByteArray(byte[] in)
returns a type-converted copy of the input vector- Parameters:
in- a byte array- Returns:
- a byte array containing the values of in
-
getByteArray
public static byte[] getByteArray(double[] in)
returns a type-converted copy of the input vector- Parameters:
in- a double array- Returns:
- a byte array containing the values of in
-
getByteArray
public static byte[] getByteArray(float[] in)
returns a type-converted copy of the input vector- Parameters:
in- a float array- Returns:
- a byte array containing the values of in
-
getByteArray
public static byte[] getByteArray(int[] in)
returns a type-converted copy of the input vector- Parameters:
in- a integer array- Returns:
- a byte array containing the values of in
-
getByteArray
public static byte[] getByteArray(long[] in)
returns a type-converted copy of the input vector- Parameters:
in- a long integer array- Returns:
- a byte array containing the values of in
-
getByteArray
public static byte[] getByteArray(short[] in)
returns a type-converted copy of the input vector- Parameters:
in- a short integer array- Returns:
- a byte array containing the values of in
-
getDouble2DArray
public static double[][] getDouble2DArray(float[][] in)
returns a type-converted copy of the input matrix- Parameters:
in- a float 2D array- Returns:
- a double 2D array containing the values of in
-
getDoubleArray
public static double[] getDoubleArray(byte[] in)
returns a type-converted copy of the input vector- Parameters:
in- an byte array- Returns:
- a double array containing the values of in
-
getDoubleArray
public static double[] getDoubleArray(double[] in)
returns a type-converted copy of the input vector- Parameters:
in- a double array- Returns:
- a double array containing the values of in
-
getDoubleArray
public static double[] getDoubleArray(float[] in)
returns a type-converted copy of the input vector- Parameters:
in- a float array- Returns:
- a double array containing the values of in
-
getDoubleArray
public static double[] getDoubleArray(int[] in)
returns a type-converted copy of the input vector- Parameters:
in- an integer array- Returns:
- a double array containing the values of in
-
getDoubleArray
public static double[] getDoubleArray(long[] in)
returns a type-converted copy of the input vector- Parameters:
in- a long integer array- Returns:
- a double array containing the values of in
-
getDoubleArray
public static double[] getDoubleArray(short[] in)
returns a type-converted copy of the input vector- Parameters:
in- an short integer array- Returns:
- a double array containing the values of in
-
getFloat2DArray
public static float[][] getFloat2DArray(double[][] in)
returns a type-converted copy of the input matrix- Parameters:
in- a double 2D array- Returns:
- a float 2D array containing the values of in
-
getFloatArray
public static float[] getFloatArray(byte[] in)
returns a type-converted copy of the input vector- Parameters:
in- a byte array- Returns:
- a float array containing the values of in
-
getFloatArray
public static float[] getFloatArray(double[] in)
returns a type-converted copy of the input vector- Parameters:
in- a double array- Returns:
- a float array containing the values of in
-
getFloatArray
public static float[] getFloatArray(float[] in)
returns a type-converted copy of the input vector- Parameters:
in- a float array- Returns:
- a float array containing the values of in
-
getFloatArray
public static float[] getFloatArray(int[] in)
returns a type-converted copy of the input vector- Parameters:
in- a integer array- Returns:
- a float array containing the values of in
-
getFloatArray
public static float[] getFloatArray(long[] in)
returns a type-converted copy of the input vector- Parameters:
in- a long integer array- Returns:
- a float array containing the values of in
-
getFloatArray
public static float[] getFloatArray(short[] in)
returns a type-converted copy of the input vector- Parameters:
in- a short integer array- Returns:
- a float array containing the values of in
-
getIntegerArray
public static int[] getIntegerArray(byte[] in)
returns a type-converted copy of the input vector- Parameters:
in- a byte array- Returns:
- a integer array containing the values of in
-
getIntegerArray
public static int[] getIntegerArray(double[] in)
returns a type-converted copy of the input vector- Parameters:
in- a double array- Returns:
- a integer array containing the values of in
-
getIntegerArray
public static int[] getIntegerArray(float[] in)
returns a type-converted copy of the input vector- Parameters:
in- a float array- Returns:
- a integer array containing the values of in
-
getIntegerArray
public static int[] getIntegerArray(int[] in)
returns a type-converted copy of the input vector- Parameters:
in- a integer array- Returns:
- a integer array containing the values of in
-
getIntegerArray
public static int[] getIntegerArray(long[] in)
returns a type-converted copy of the input vector- Parameters:
in- a long integer array- Returns:
- a integer array containing the values of in
-
getIntegerArray
public static int[] getIntegerArray(short[] in)
returns a type-converted copy of the input vector- Parameters:
in- a short integer array- Returns:
- a integer array containing the values of in
-
getLongArray
public static long[] getLongArray(byte[] in)
returns a type-converted copy of the input vector- Parameters:
in- a byte array- Returns:
- a long integer array containing the values of in
-
getLongArray
public static long[] getLongArray(double[] in)
returns a type-converted copy of the input vector- Parameters:
in- a double array- Returns:
- a long integer array containing the values of in
-
getLongArray
public static long[] getLongArray(float[] in)
returns a type-converted copy of the input vector- Parameters:
in- a float array- Returns:
- a long integer array containing the values of in
-
getLongArray
public static long[] getLongArray(int[] in)
returns a type-converted copy of the input vector- Parameters:
in- a integer array- Returns:
- a long integer array containing the values of in
-
getLongArray
public static long[] getLongArray(long[] in)
returns a type-converted copy of the input vector- Parameters:
in- a long integer array- Returns:
- a long integer array containing the values of in
-
getLongArray
public static long[] getLongArray(short[] in)
returns a type-converted copy of the input vector- Parameters:
in- a short integer array- Returns:
- a long integer array containing the values of in
-
getShortArray
public static short[] getShortArray(byte[] in)
returns a type-converted copy of the input vector- Parameters:
in- a short integer array- Returns:
- a short integer array containing the values of in
-
getShortArray
public static short[] getShortArray(double[] in)
returns a type-converted copy of the input vector- Parameters:
in- a double array- Returns:
- a short integer array containing the values of in
-
getShortArray
public static short[] getShortArray(float[] in)
returns a type-converted copy of the input vector- Parameters:
in- a float array- Returns:
- a short integer array containing the values of in
-
getShortArray
public static short[] getShortArray(int[] in)
returns a type-converted copy of the input vector- Parameters:
in- a integer array- Returns:
- a short integer array containing the values of in
-
getShortArray
public static short[] getShortArray(long[] in)
returns a type-converted copy of the input vector- Parameters:
in- a long integer array- Returns:
- a short integer array containing the values of in
-
getShortArray
public static short[] getShortArray(short[] in)
returns a type-converted copy of the input vector- Parameters:
in- a short integer array- Returns:
- a short integer array containing the values of in
-
-