Jump to content

National indentification number

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Simpletesting

Simpletesting

    Newbie

  • Members
  • Pip
  • 1 posts
Dutch National indentification number
I need to test a number in java to see if it's right or false.
This is the formula to test it;
9 x A) + (8 x B) + (7 x C) + (6 x D) + (5 x E) + (4 x F) + (3 x G) + (2 x H) - (1 x I)

With this formula you can get 91million numbers like 111222333 or 123456782.

But i need to figur out how i can make a test in java to check if the number is false or true.

i need to use this method

public static boolean checkBSN(int bsnnummer)


#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Copy some more info from wikipedia next time. Noone's ever going to know what your formula's about unless you specify that
(9 x A) + (8 x B) + (7 x C) + (6 x D) + (5 x E) + (4 x F) + (3 x G) + (2 x H) - (1 x I)
Is for a 9digit number: ABCDEFGHI. And that formula should return 11 to be true, false if it isn't.

The only dificult thing you should have is to get the digits out of an integer. This site gives a nice example: Java Home: split of a 4 digit number
But try to fit it into a for-loop if you have to do it 9 times.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users