Lösung modern: lastschrift.html
Lösung mit Tabelle: lastschrift_loesung.html
public class IBANPruefziffer{ public static void main(String[] args) { long blz = 21050170L; long ktNr = 12345678L; long pz = berechnePruefziffer(blz, ktNr); System.out.println(pz); } public static long berechnePruefziffer(long blz, long ktNr) { while(blz >= 97) { blz = blz - 97; } ktNr = ktNr * 1000000; ktNr = ktNr + 131400; while(ktNr >= 88529281) { ktNr = ktNr - 88529281; } while(ktNr >= 97) { ktNr = ktNr - 97; } long pz = blz * 62 + ktNr; while(pz >= 97) { pz = pz - 97; } pz = 98 - pz; return pz; } }