# Class Converter

java.lang.Object
com.sparshui.common.utils.Converter

public class Converter extends Object
Contains conversion methods that are needed by several elements of the Gesture Server. adapted by Bob Hanson for Jmol 11/29/2009 (added several useful methods)

Author:
  Jay Roltgen

## Constructor Summary

Constructors
Constructor
Description
`Converter()`

## Method Summary

Modifier and Type
Method
Description
`static float`
`byteArrayToFloat(byte[] data, int i)`
`static int`
`byteArrayToInt(byte[] b)`
Converts a byte array to an integer.
`static int`
`byteArrayToInt(byte[] b, int i)`
`static long`
`byteArrayToLong(byte[] data, int i)`
`static String`
`byteArrayToString(byte[] bytes)`
`static void`
`floatToByteArray(byte[] data, int i, float fdata)`
`static void`
`intToByteArray(byte[] data, int i, int idata)`
`static byte[]`
`intToByteArray(int intBits)`
Converts an integer intBits into a byte array.
`static void`
`longToByteArray(byte[] data, int i, long ldata)`
`static byte[]`
`stringToByteArray(String s)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Converter

public Converter()

## Method Details

### intToByteArray

public static byte[] intToByteArray(int intBits)
Converts an integer intBits into a byte array.

Parameters:
  `intBits` - The integer in network byte order.
Returns:
  A byte array in network byte order.

### intToByteArray

public static void intToByteArray(byte[] data, int i, int idata)

### byteArrayToInt

public static int byteArrayToInt(byte[] b)
Converts a byte array to an integer.

Parameters:
  `b` - A byte array representing an integer in network byte order.
Returns:
  An integer that was created from the byte array.

### byteArrayToInt

public static int byteArrayToInt(byte[] b, int i)

### floatToByteArray

public static void floatToByteArray(byte[] data, int i, float fdata)

### byteArrayToFloat

public static float byteArrayToFloat(byte[] data, int i)

### longToByteArray

public static void longToByteArray(byte[] data, int i, long ldata)

### byteArrayToLong

public static long byteArrayToLong(byte[] data, int i)

### byteArrayToString

public static String byteArrayToString(byte[] bytes)

### stringToByteArray

public static byte[] stringToByteArray(String s)