Menu Close

Java program to check for IMEI number …FTC

The International Mobile Equipment Identity (IMEI) number is a unique identification or serial number that all mobile phones and smartphones have. It is normally 15 digits long.

The IMEI number can be found on the silver sticker on the back of your phone, under the battery pack, or on the box your phone came in.
You can also display the IMEI number on the screen of your mobile phone or smartphone by entering *#06# into the keypad.

Hint: If the number length if equal to 15 then it can be termed as IMEI Number

Input:  490154203237518   

Output:  Yes, its IMEI Number
import java.io.*;
import java.util.*;
public class temp {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String imei;
    System.out.println("Enter the number to check:  ");
    imei = scan.nextLine();

    if(imei.length() == 15){
      System.out.println("Yes, its IMEI Number");
    }
    else{
      System.out.print("No, its not IMEI Number");
    }
	}
}

INPUT_1:
Enter the number to check:
490154203237518

OUTPUT:
Yes, its IMEI Number


INPUT_2:
Enter the number to check:
65412248

OUTPUT:
No, its not IMEI Number


INPUT_3:
Enter the number to check:
890264303589145

OUTPUT:
Yes, its IMEI Number


INPUT_4:
Enter the number to check:
789456851249652

OUTPUT:
Yes, its IMEI Number


INPUT_5:
Enter the number to check:
1254856982451

OUTPUT:
No, its not IMEI Number


ILLUSTRATION

Executed using javac in linux terminal