Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Fairly new to Java, need help with bigIntegers

ryman_2000ryman_2000 Member Posts: 27
Hi,

I'm trying to make an RSA decrypt program, but before I can do that, I want to make a simple test program. The Values are going to be Hex. Here is what I did:

import java.math.BigInteger;
public class Math {
public static void main (String[]args) {
BigInteger x= new BigInteger("abcde343cdef",16);
BigInteger y =new BigInteger("abc432bcdef",16);
BigInteger a = x.add(y);
System.out.println (a);
}
}

This program will print the results to the screen, but in Decimal. I want everything to be done in Hex. If i take the 16s off, I get an error, and I don't really know how to use the 0x (I just got errors, this is the only program that wont get errors)

Also, could you please tell me how to do "to the power of" with large hex numbers and "mod" with large hex numbers. I've been trying everything but can't get it to print out hex numbers. Thanks in advance,

ryman_2000

Comments

Sign In or Register to comment.