net.sourceforge.jaulp.math
Class MathUtils

java.lang.Object
  extended by net.sourceforge.jaulp.math.MathUtils

public class MathUtils
extends java.lang.Object

Utility class for the use numbers.

Version:
1.0
Author:
Asterios Raptis

Constructor Summary
MathUtils()
           
 
Method Summary
static int[] getPrimeNumbers(int quantity)
          Gets the prime numbers for the given quantity.
static boolean isBetween(int min, int max, int index)
          Checks the given index is between the range from min and max.
static boolean isInRange(int min, int max, int number)
          Checks the given number is in range from min and max.
static boolean isNegative(int number)
          Checks if the number is negative.
static boolean isPositive(int number)
          Checks if the number is positive.
static boolean isPrimeNumber(int number)
          Checks if the number is a prime number.
static int[] printAllPrimeNumbersTill(int noOfPrimes)
          Prints all prime numbers till the given number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathUtils

public MathUtils()
Method Detail

isPositive

public static boolean isPositive(int number)
Checks if the number is positive.

Parameters:
number - The number.
Returns:
Returns true if the number is positive otherwise false.

isNegative

public static boolean isNegative(int number)
Checks if the number is negative.

Parameters:
number - The number.
Returns:
Returns true if the number is negative otherwise false.

isPrimeNumber

public static boolean isPrimeNumber(int number)
Checks if the number is a prime number.

Parameters:
number - The number.
Returns:
Returns true if the number is a prime number otherwise false.

printAllPrimeNumbersTill

public static int[] printAllPrimeNumbersTill(int noOfPrimes)
Prints all prime numbers till the given number.

Parameters:
noOfPrimes - The limit.

isBetween

public static boolean isBetween(int min,
                                int max,
                                int index)
Checks the given index is between the range from min and max.

Parameters:
min - The minimum.
max - The maximum.
index - The index.
Returns:
Returns true if the index is betwenn the range from min and max otherwise false.

isInRange

public static boolean isInRange(int min,
                                int max,
                                int number)
Checks the given number is in range from min and max.

Parameters:
min - The minimum.
max - The maximum.
number - The index.
Returns:
Returns true if the number is in range from min and max otherwise false.

getPrimeNumbers

public static int[] getPrimeNumbers(int quantity)
Gets the prime numbers for the given quantity.

Parameters:
quantity - The quantity.
Returns:
An array from prime numbers.


Copyright © 2010. All Rights Reserved.