I\'m trying to read some really big numbers from standard input and add them together.
However, to add to BigInteger, I need to use BigInteger.valueOf(long);>
BigInteger.valueOf(long);>
BigInteger has a constructor where you can pass string as an argument.
try below,
private void sum(String newNumber) { // BigInteger is immutable, reassign the variable: this.sum = this.sum.add(new BigInteger(newNumber)); }