net.sourceforge.jgrib
Class Bytes2Number

java.lang.Object
  extended by net.sourceforge.jgrib.Bytes2Number

public class Bytes2Number
extends java.lang.Object

A class that contains several static methods for converting multiple bytes into one float or integer.

Version:
1.0
Author:
Benjamin Stark

Constructor Summary
Bytes2Number()
           
 
Method Summary
static float float4(int a, int b, int c, int d)
          Convert four bytes into a float value.
static int int2(int a, int b)
          Convert two bytes into a signed integer.
static int int3(int a, int b, int c)
          Convert three bytes into a signed integer.
static int int4(int a, int b, int c, int d)
          Convert four bytes into a signed integer.
static int uint2(int a, int b)
          Convert two bytes into an unsigned integer.
static int uint3(int a, int b, int c)
          Convert three bytes into an unsigned integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bytes2Number

public Bytes2Number()
Method Detail

int2

public static int int2(int a,
                       int b)
Convert two bytes into a signed integer.

Parameters:
a - higher byte
b - lower byte
Returns:
integer value

int3

public static int int3(int a,
                       int b,
                       int c)
Convert three bytes into a signed integer.

Parameters:
a - higher byte
b - middle part byte
c - lower byte
Returns:
integer value

int4

public static int int4(int a,
                       int b,
                       int c,
                       int d)
Convert four bytes into a signed integer.

Parameters:
a - highest byte
b - higher middle byte
c - lower middle byte
d - lowest byte
Returns:
integer value

uint2

public static int uint2(int a,
                        int b)
Convert two bytes into an unsigned integer.

Parameters:
a - higher byte
b - lower byte
Returns:
integer value

uint3

public static int uint3(int a,
                        int b,
                        int c)
Convert three bytes into an unsigned integer.

Parameters:
a - higher byte
b - middle byte
c - lower byte
Returns:
integer value

float4

public static float float4(int a,
                           int b,
                           int c,
                           int d)
Convert four bytes into a float value.

Parameters:
a - highest byte
b - higher byte
c - lower byte
d - lowest byte
Returns:
float value