Problem statement I have a Swedish Bank (SEB) account number and I need to generate the IBAN for this account number (in java code)
A possibility I can see that it's possible if I use website: https://www.ibancalculator.com/
What I tried https://github.com/arturmkrtchyan/iban4j
Iban iban = new Iban.Builder()
.countryCode(CountryCode.SE)
.bankCode("XXXX")
.accountNumber("XXXXXXX")
.build();
Here X is a digit in my account number and the account number is overall 11 digits long (first 4 are clearing number and next 7 is account number).
However, when I try this, I get the following: length is 11, expected BBAN length is: 20
Can someone please point out what am I doing wrong here OR is there some other better way.
P.S. If I use same values on the ibancalculator.com, I get the correct IBAN for my account.
The error you obtain gives a hint that you need to use full length of the account number as indicated in this example:
Iban iban = new Iban.Builder()
.countryCode(CountryCode.SE)
.bankCode("500")
.accountNumber("0000005839825746")
.build();
In other words, ensure that you are supplying expected 20 digits before calling .build()
.