long BLZ = 12345678l;
long KNr = 1234567890l;
String landCode = "1314";
System.out.println(Long.MAX_VALUE);
System.out.println(String.valueOf(BLZ) + String.valueOf(KNr) + landCode + "00");
leads to the output
9223372036854775807
123456781234567890131400
The number you try to parse in is bigger than a long
can handle.
Edit: You asked how to solve your problem. In the comments of your question there is the theory that you want to calculate the checksum of an IBAN. You can do that by using java.math.BigInteger
:
System.out.println(Long.MAX_VALUE);
long BLZ = 12345678l;
long KNr = 1234567890l;
String landCode = "1314";
String val = String.valueOf(BLZ) + String.valueOf(KNr) + landCode + "00";
System.out.println(val);
System.out.println(BigInteger.valueOf(98).subtract(new BigInteger(val).mod(BigInteger.valueOf(97))));
This leads to the following output:
9223372036854775807
123456781234567890131400
87
Alternatively you can check the IBAN Documentation (it's german but that shouldn't be problem for you I suppose ;-) where in chapter 4 there is a description of a way to calculate the checksum if you're limited (like here). You will still need longs
to be able to implement that, because 9-digit numbers can exceed the range of an int
.