system
Class HelperMethods

java.lang.Object
  extended bysystem.HelperMethods

public class HelperMethods
extends Object

This class contains general methods for use in the program.

Version:
1
Author:
Berend "Kirk" Wouda

Constructor Summary
HelperMethods()
           
 
Method Summary
static long convertByteArrayToLong(byte[] unsignedintarray)
          Converts a byte array standing for an unsigned int read from a file in Little Endian, into a Java long.
static byte[] convertLongToByteArray(long javalong)
          Converts a Java long into a byte aray standing for an unsigned int to be written to a file in Little Endian.
static void reverseArray(byte[] array)
          Reverses the given array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelperMethods

public HelperMethods()
Method Detail

convertByteArrayToLong

public static long convertByteArrayToLong(byte[] unsignedintarray)
                                   throws IOException
Converts a byte array standing for an unsigned int read from a file in Little Endian, into a Java long.

Parameters:
unsignedintarray - The byte array.
Returns:
The long representing the unsigned int.
Throws:
IOException - When the stream stuff breaks.

convertLongToByteArray

public static byte[] convertLongToByteArray(long javalong)
                                     throws IOException
Converts a Java long into a byte aray standing for an unsigned int to be written to a file in Little Endian.

Parameters:
javalong - The long.
Returns:
The byte array representing the unsigned int in Little Endian.
Throws:
IOException - When the stream stuff breaks.

reverseArray

public static void reverseArray(byte[] array)
Reverses the given array. Note that it does not copy it, it edits the array itself.

Parameters:
array - The arrry to be reversed.