it.andynaz.irex.dr1000.scribble
Class Util

java.lang.Object
  extended by it.andynaz.irex.dr1000.scribble.Util

public class Util
extends Object

Usefull methods.

Version:
2013-01-04
Author:
andynaz

Constructor Summary
Util()
           
 
Method Summary
static float get4ByteFloat(int i1, int i2, int i3, int i4)
          Transform 4 bytes in a float.
static int get4ByteInt(int i1, int i2, int i3, int i4)
          Transform 4 bytes in an int.
static void skip(List l, int n)
          Remove the first n elements from a list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

get4ByteInt

public static int get4ByteInt(int i1,
                              int i2,
                              int i3,
                              int i4)
Transform 4 bytes in an int. The 4 bytes are treated in inverse order, like "i4 i3 i2 i1", considering the bits of each one. Each int must represent a byte, so its value must be included in the range [0, 255].

Parameters:
i1 - an int representing a byte
i2 - an int representing a byte
i3 - an int representing a byte
i4 - an int representing a byte
Returns:
the int correspong to the 4 bytes' bits
Throws:
IllegalArgumentException - if at least one of the ints does not represent a byte, ie its value does not belong to the range [0, 255]

get4ByteFloat

public static float get4ByteFloat(int i1,
                                  int i2,
                                  int i3,
                                  int i4)
Transform 4 bytes in a float. The 4 bytes are treated in inverse order, like "i4 i3 i2 i1", considering the bits of each one. Each int must represent a byte, so its value must be included in the range [0, 255].

The 32 bits are converted according to the IEEE 754 floating-point "single format" bit layout, using the Float.intBitsToFloat(int) method.

Parameters:
i1 - valore compreso nell'intervallo [0,255]
i2 - valore compreso nell'intervallo [0,255]
i3 - valore compreso nell'intervallo [0,255]
i4 - valore compreso nell'intervallo [0,255]
Returns:
il valore del float corrispondente alla sequenza di bit dei 4 byte

skip

public static void skip(List l,
                        int n)
Remove the first n elements from a list.

Parameters:
l - collection from whom remove the elements
n - number of elements to remove


(c) 2013 andynaz - http://andynaz.altervista.org