jxl.biff
Class IntegerHelper

java.lang.Object
  extended byjxl.biff.IntegerHelper

public final class IntegerHelper
extends java.lang.Object

Converts excel byte representations into integers


Method Summary
static byte[] getFourBytes(int i)
          Gets a four byte array from an integer
static void getFourBytes(int i, byte[] target, int pos)
          Converts an integer into four bytes, and places it in the array at the specified position
static int getInt(byte b1, byte b2)
          Gets an int from two bytes
static int getInt(byte b1, byte b2, byte b3, byte b4)
          Gets an int from four bytes, doing all the necessary swapping
static short getShort(byte b1, byte b2)
          Gets an short from two bytes
static byte[] getTwoBytes(int i)
          Gets a two byte array from an integer
static void getTwoBytes(int i, byte[] target, int pos)
          Converts an integer into two bytes, and places it in the array at the specified position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInt

public static int getInt(byte b1,
                         byte b2)
Gets an int from two bytes

Parameters:
b2 - the second byte
b1 - the first byte
Returns:
The integer value

getShort

public static short getShort(byte b1,
                             byte b2)
Gets an short from two bytes

Parameters:
b2 - the second byte
b1 - the first byte
Returns:
The short value

getInt

public static int getInt(byte b1,
                         byte b2,
                         byte b3,
                         byte b4)
Gets an int from four bytes, doing all the necessary swapping

Parameters:
b1 - a byte
b2 - a byte
b3 - a byte
b4 - a byte
Returns:
the integer value represented by the four bytes

getTwoBytes

public static byte[] getTwoBytes(int i)
Gets a two byte array from an integer

Parameters:
i - the integer
Returns:
the two bytes

getFourBytes

public static byte[] getFourBytes(int i)
Gets a four byte array from an integer

Parameters:
i - the integer
Returns:
a four byte array

getTwoBytes

public static void getTwoBytes(int i,
                               byte[] target,
                               int pos)
Converts an integer into two bytes, and places it in the array at the specified position

Parameters:
target - the array to place the byte data into
pos - the position at which to place the data
i - the integer value to convert

getFourBytes

public static void getFourBytes(int i,
                                byte[] target,
                                int pos)
Converts an integer into four bytes, and places it in the array at the specified position

Parameters:
target - the array which is to contain the converted data
pos - the position in the array in which to place the data
i - the integer to convert