📜  amstrong - Java (1)

📅  最后修改于: 2023-12-03 15:29:20.154000             🧑  作者: Mango

Amstrong - Java

Amstrong-Java is a library for checking if a number is an Amstrong number in Java.

What is an Amstrong number?

An Amstrong number is a number that the sum of its digits, each raised to the power of the number of digits, is equal to the original number. For example, 153 is an Amstrong number because 1^3 + 5^3 + 3^3 = 153.

Installation

To use Amstrong-Java in your Java project, you can download the jar file from the Amstrong-Java Github repository and add it to your project's classpath.

Usage

To use the Amstrong-Java library in your Java code, you can import the Amstrong class and use its static isAmstrong() method to check if a given number is an Amstrong number.

import com.example.amstrong.Amstrong;

public class Example {
  public static void main(String[] args) {
    int number = 153;
    boolean isAmstrong = Amstrong.isAmstrong(number);
    if (isAmstrong) {
      System.out.println(number + " is an Amstrong number.");
    } else {
      System.out.println(number + " is not an Amstrong number.");
    }
  }
}
Contributions

If you find any issues or have suggestions for improvements, please submit them in the Amstrong-Java Github issues. Pull requests are also welcome.

License

Amstrong-Java is released under the MIT License. See the LICENSE file for more information.