Primality test Java

It is a code for primality test. If you have a more efficient code or a clean code, please give me some advice.

import java.io.*;

class file name{
		public static void main(String[]args) throws IOException
		{
			BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
			
			System.out.print("Please enter a positive integer");
			String str = br.readLine();
			int a =Integer.parseInt(str);
			
			boolean sosu = true;
			
			if(a == 1)sosu = false;
			
			for(int b = 2; b*b <= a; b++){
				if(a%b == 0){
					sosu = false;
					break;
				}
			}
			
			if(sosu == true) System.out.println("\n"+a+"Is a prime number");
			else System.out.println("\n"+a+"Is not a prime number");
			
			
		}
}

Recommended Posts

Primality test Java
Fastest Primality Test C # Java C ++
Java Unit Test Library-Artery-Sample
I made a primality test program in Java
I wrote a primality test program in Java
test
[Java] JUnit4 test case example
test
Java test code method collection
2018 Java Proficiency Test for Newcomers-Basics-
Java
test
test
Java
Implement Table Driven Test in Java 14
Execution environment test after Java installation
Java Unit Test Library-Artery-ArValidator Validates Objects
Java Unit Test Library-Artery-Current Date Judgment
Java SE Bronze exam test content
[Java] Test private methods with JUnit
Java Unit Test Library-Artery / JUnit4-Array Equivalence
Java learning (0)
Studying Java ―― 3
[Java] array
Java protected
[Java] Annotation
[Java] Module
Java array
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Java methods
Java Unit Test Library-Artery / JUnit4-Numerical equality judgment
Java method
java (constructor)
Java array
[Java] ArrayDeque
java (override)
java (method)
Java Day 2018
Java string
java (array)
Java static
Java serialization
java beginner 4
JAVA paid
Studying Java ―― 4
Java (set)
java shellsort
[Java] compareTo
Studying Java -5
java reflexes
java (interface)
Java Artery-Easy to use unit test library
Java memorandum
☾ Java / Collection
Java EE test (CDI / interceptor) with Arquillian
Java array
Studying Java ―― 1
[Java] Array
[Java] Polymorphism