votingSystem
Class Utility

java.lang.Object
  extended byvotingSystem.Utility

public class Utility
extends java.lang.Object

This class implements some useful functions for use with the cryptosystem

Author:
Bent

Constructor Summary
Utility()
           
 
Method Summary
static int bigIntToInt(java.math.BigInteger i)
          Converts a BigInteger to an int
static long faculty(long n)
          Calculates n!
static java.math.BigInteger intToBigInt(int i)
          Converts an int to a BigInteger
static java.math.BigInteger lcm(java.math.BigInteger n1, java.math.BigInteger n2)
          Finds the least common multiplum of two BigIntegers
static double log2(int i)
           
static java.math.BigInteger longToBigInt(long i)
          Converts a long to a BigInteger
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utility

public Utility()
Method Detail

bigIntToInt

public static int bigIntToInt(java.math.BigInteger i)
Converts a BigInteger to an int

Parameters:
i - BigInteger to be converted
Returns:
An int

intToBigInt

public static java.math.BigInteger intToBigInt(int i)
Converts an int to a BigInteger

Parameters:
i - int to be converted
Returns:
A BigInteger

longToBigInt

public static java.math.BigInteger longToBigInt(long i)
Converts a long to a BigInteger

Parameters:
i - The long to be converted
Returns:
A BigInteger

lcm

public static java.math.BigInteger lcm(java.math.BigInteger n1,
                                       java.math.BigInteger n2)
Finds the least common multiplum of two BigIntegers

Parameters:
n1 -
n2 -
Returns:

faculty

public static long faculty(long n)
Calculates n!

Parameters:
n -
Returns:

log2

public static double log2(int i)