How to check whether a given integer is prime number or not

This is the first solution to find whether the given integer number is prime or not using the core logic, that is to check the divisibility of that number until the square root of that number.

import java.util.Scanner;
public class Primechecknum {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		System.out.println("OUTPUT:");
		Scanner inpNum= new Scanner(System.in);
		System.out.print("Enter an integer value for prime number check:");
		int num=inpNum.nextInt();
		int isPrime=0;
		
		//Initialize the lower and upper boundary values in the for loop
		int bvalToCheck = (int) Math.sqrt(num);
		for(int i=2;i<=bvalToCheck;i++) {
			if(num%i==0) {
				isPrime += 1;
				break;
			}				
		}
		if (isPrime==0)
			System.out.println("The number "+ num +" is prime");
		else
			System.out.println("The number "+ num+ " is not prime");
		inpNum.close();
	 }
}
OUTPUT:
 Enter an integer value to check whether it is prime or not
 541
 The number 541 is prime