How to find an Element in an Array by Linear Search using Java

The preceding Java code implements linear search.
  1. import java.util.Scanner;  
  2. class LinearSearch   
  3. {  
  4.     public static void main(String args[])   
  5.     {  
  6.         int count, num, element, array[];  
  7.         //To capture user input  
  8.         Scanner input = new Scanner(System. in );  
  9.         System.out.println("Enter number of elements in array:");  
  10.         num = input.nextInt();  
  11.         //Creating array to store the all the numbers  
  12.         array = new int[num];  
  13.         System.out.println("Enter " + num + " integers:");  
  14.         //Loop to store each numbers in array  
  15.         for (count = 0; count < num; count++)  
  16.         array[count] = input.nextInt();  
  17.         System.out.println("Enter the element to be searched:");  
  18.         element = input.nextInt();  
  19.         for (count = 0; count < num; count++)   
  20.         {  
  21.             if (array[count] == element)  
  22.             {  
  23.                 System.out.println(element + " is present at location " + (count + 1));  
  24.                 /*Item is found so to stop the search and to come out of the 
  25.                  * loop use break statement.*/  
  26.                 break;  
  27.             }  
  28.         }  
  29.         if (count == num)   
  30.             System.out.println(element + " doesn't exist in array :(");  
  31.     }  
  32. }  
Thank you, keep learning and sharing