**Java Number Program**

➤ Even Number in Java

➤ Odd Number in Java

➤ Prime Number in Java

➤ Twin Prime Number

➤ Magic Number in Java

➤ Neon Number in Java

➤ Tech Number in Java

➤ Harshad Number

➤ Armstrong Number

➤ Palindrome Number

➤ Perfect Number in Java

➤ Pronic Number in Java

➤ Spy Number in Java

➤ Kaprekar Number

➤ Automorphic Number

➤ Krishnamurthy Number

➤ Sunny Number in Java

➤ Buzz Number in Java

➤ Evil Number in Java

➤ Duck Number in Java

➤ Nelson Number in Java

➤ Strong Number in Java

➤ Java Special Number

➤ Disarium Number

Java Number Program Using String

➤ Unique Number in Java

➤ Fascinating Number

➤ ISBN Number in Java

In this post, we will develop a Java program to check whether the given number is a Nelson Number or not?

In cricket, the number 111 is sometimes called “a Nelson” after Admiral Nelson, who allegedly only had “One Eye, One Arm, One Leg” near the end of his life. This is, in fact inaccurate—Nelson never lost a leg. Alternate meanings include “One Eye, One Arm, One Ambition” and “One Eye, One Arm, One Arsehole”.

Particularly in cricket, multiples of 111 are called a double Nelson (222), triple Nelson (333), and so on.

A score of 111 is considered by some to be unlucky. To combat the supposed bad luck, some watching lift their feet off the ground. Since an umpire cannot sit down and raise his feet, the international umpire David Shepherd had a whole retinue of peculiar mannerisms if the score was ever a Nelson multiple. He would hop, shuffle, or jiggle, particularly if the number of wickets also matched—111/1, 222/2 e.t.c.

## Java Program to Check Nelson Number

```
import java.util.Scanner;
public class NelsonNumber {
// method to check the given number
// is nelson number or not
public static boolean isNelson(int number) {
// if number is divisible by 111
// then the number is nelson number
if(number % 111 == 0)
return true;
return false;
}
public static void main(String[] args) {
// declare variables
int number = 0;
boolean result = false;
// create Scanner class object to
// read input
Scanner scan = new Scanner(System.in);
System.out.print("Enter an integer number::");
number = scan.nextInt();
// check number
result = isNelson(number);
// display result
if(result)
System.out.println(number +
" is a Nelson number");
else
System.out.println(number +
" is not a Nelson number");
// close Scanner class object
scan.close();
}
}
```

The output for different test-cases are:-

Enter an integer number:: 222

222 is a Nelson number

Enter an integer number:: 220

220 is not a Nelson number

On 11 November 2011, in a Test match between South Africa and Australia with the time at 11:11 and with South Africa requiring 111 runs to win, the majority of the crowd and umpire Ian Gould did Shepherd’s leg raise Nelson for that minute with the scoreboard reading 11:11 11/11/11. Source:- Wikipedia

If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or you find anything incorrect? Let us know in the comments. Thank you!