de.cscc.crypto.util
Class LongUtil

java.lang.Object
  extended byde.cscc.crypto.util.LongUtil

public final class LongUtil
extends Object

LongUtil Class. Class that hold only static methods to convert longs and long arrays to Strings. These Strings holds the hex or binary representation of the converted longs or long arrays. This class can't be instance, because its constructor is private.

Version:
$Revision: 1.2 $
Author:
Uwe Günther

Method Summary
static String toBin(long in)
          Converts byte to binary representation.
static String toBin(long[] in)
          Converts long[] to binary representation.
static byte[] toByteArray(long input)
          Converts long to a new byte[8]
static int toByteArray(long input, byte[] output, int outputOffset)
          Converts long to a byte[]
static String toHex(long in)
          Converts long to hex representation.
static String toHex(long[] in)
          Converts long[] to hex representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toBin

public static String toBin(long in)
Converts byte to binary representation.

Parameters:
in - long that will be converted.
Returns:
String with hex representation of in.

toBin

public static String toBin(long[] in)
Converts long[] to binary representation.

Parameters:
in - long[] that will be converted.
Returns:
String with hex representation of in.

toHex

public static String toHex(long in)
Converts long to hex representation.

Parameters:
in - long that will be converted.
Returns:
String with hex representation of in.

toHex

public static String toHex(long[] in)
Converts long[] to hex representation.

Parameters:
in - long[] that will be converted.
Returns:
String with hex representation of in.

toByteArray

public static byte[] toByteArray(long input)
Converts long to a new byte[8]

Parameters:
input - that will be converted to a new byte[8] array.
Returns:
byte[8] array that holds the long in as byte array.

toByteArray

public static int toByteArray(long input,
                              byte[] output,
                              int outputOffset)
                       throws ShortBufferException
Converts long to a byte[]

Parameters:
input - that will be converted to a byte[] array.
output - the buffer for the result.
outputOffset - the offset in output where the result is stored.
Returns:
the number of bytes stored in output.
Throws:
ShortBufferException - if the given output is too small to hold the result.


Copyright © 2001, 2002 by Uwe Günther. See the COPYING file for more details. Browse the source as HTML.