package com.mindprod.example;
import java.math.BigInteger;
import java.security.SecureRandom;
import static java.lang.System.*;
/**
* Demonstrate the basic use of BigInteger.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2006-02-28
* @since 2006-02-28
*/
@SuppressWarnings( { "UnusedAssignment" } )
public final class TestBigInteger
{
/**
* Test BigInteger
*
* @param args not used
*/
public static void main( String[] args )
{
BigInteger a = new BigInteger( "1234567890123456789012234" );
BigInteger b = new BigInteger( "-12345" );
BigInteger c = a.add( b );
out.println( c );
c = c.multiply( BigInteger.TEN );
out.println( c );
c = c.divide( BigInteger.valueOf( 1024 ) );
out.println( c );
BigInteger p = new BigInteger( 1024
,
100
,
new SecureRandom() );
BigInteger d = BigInteger.valueOf( 7 )
.modInverse( p.subtract( BigInteger.ONE ) );
out.println( d );
byte[] dbytes = d.toByteArray();
}
}