Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 1.19 KB

File metadata and controls

52 lines (43 loc) · 1.19 KB

Java Prime Checker

A simple Java program to check whether a given number is prime. It includes error handling for invalid inputs and uses an optimized algorithm for prime detection. The package follows best practices, and the program ensures efficient resource management.

Features

  • Checks if a number is prime.
  • Handles invalid inputs gracefully.
  • Uses an optimized algorithm for efficiency.

Requirements

  • Java 8 or later

Installation & Usage

  1. Clone the repository:
    git clone https://github.com/nurulashraf/java-prime-checker.git
  2. Navigate to the project directory:
    cd java-prime-checker
  3. Compile the program:
    javac src/primechecker/PrimeChecker.java
  4. Run the program:
    java -cp src primechecker.PrimeChecker

Docker

Build and run using Docker:

docker build -t prime-checker .
docker run -it prime-checker

Repository Structure

java-prime-checker/
│── src/
│   └── PrimeChecker.java
│── Dockerfile
│── .dockerignore
│── README.md
└── LICENSE

License

This project is licensed under the MIT License. See the LICENSE file for details.