/** * @author lautturi.com * Java example: larger number in java than long */ import java.math.BigInteger; import java.util.*; public class Lautturi { public static void main(String[] args) { BigInteger reallyBig = new BigInteger("1234567890123456890"); BigInteger notSoBig = new BigInteger("2743561234"); reallyBig = reallyBig.add(notSoBig); System.out.println(notSoBig); System.out.println(reallyBig); } }
output:
2743561234 1234567892867018124