Skip to content

Instantly share code, notes, and snippets.

@bchetty
Created May 24, 2013 20:22
Show Gist options
  • Select an option

  • Save bchetty/5646256 to your computer and use it in GitHub Desktop.

Select an option

Save bchetty/5646256 to your computer and use it in GitHub Desktop.
Looping through a range of BigInteger values.
import java.math.BigInteger;
public class BigIntTest {
public static void main(String[] args) {
BigInteger bigInt1 = new BigInteger("1000000000000000");
BigInteger bigInt2 = new BigInteger("1000000000000500");
//Loop from bigInt1 to bigInt2
for(BigInteger bigInt = bigInt1; bigInt.compareTo(bigInt2) < 0; bigInt = bigInt.add(BigInteger.ONE)) {
System.out.println("I'm so big now : " + bigInt);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment