Use the java.math.BigDecimal (or java.math.BigInteger) class for extremely large numbers.
What's probably happening is that you're using an int or a double, and that number is MUCH too large for those datatypes in Java. Using BigDecimal, which can be arbitrarily long, will solve your problem given time.
edit - previously I had written "java.util.BigDecimal", which is the wrong package.