Class MathConverterUtils

java.lang.Object
software.bluelib.utils.conversion.MathConverterUtils

public class MathConverterUtils extends Object
A class providing methods for common unit and date conversions.

Key Methods:

Since:
1.0.0
  • Method Details

    • inchesToCentimeters

      public static double inchesToCentimeters(double pInches)
      A Double that converts a length from inches to centimeters.
      Parameters:
      pInches - Double - The length in inches.
      Returns:
      The length in centimeters.
      Since:
      1.0.0
    • centimetersToInches

      public static double centimetersToInches(double pCentimeters)
      A Double that converts a length from centimeters to inches.
      Parameters:
      pCentimeters - Double - The length in centimeters.
      Returns:
      The length in inches.
      Since:
      1.0.0
    • celsiusToFahrenheit

      public static double celsiusToFahrenheit(double pCelsius)
      A Double that converts a temperature from Celsius to Fahrenheit.
      Parameters:
      pCelsius - Double - The temperature in Celsius.
      Returns:
      The temperature in Fahrenheit.
      Since:
      1.0.0
    • fahrenheitToCelsius

      public static double fahrenheitToCelsius(double pFahrenheit)
      A Double that converts a temperature from Fahrenheit to Celsius.
      Parameters:
      pFahrenheit - Double - The temperature in Fahrenheit.
      Returns:
      The temperature in Celsius.
      Since:
      1.0.0
    • kilometersToMiles

      public static double kilometersToMiles(double pKilometers)
      A Double that converts a distance from kilometers to miles.
      Parameters:
      pKilometers - Double - The distance in kilometers.
      Returns:
      The distance in miles.
      Since:
      1.0.0
    • milesToKilometers

      public static double milesToKilometers(double pMiles)
      A Double that converts a distance from miles to kilometers.
      Parameters:
      pMiles - Double - The distance in miles.
      Returns:
      The distance in kilometers.
      Since:
      1.0.0
    • stringToDate

      public static Date stringToDate(String pDateStr, String pFormat) throws ParseException
      A Date that converts a string to a Date object.
      Parameters:
      pDateStr - String - The date in string format (e.g., "yyyy-MM-dd").
      pFormat - String - The format of the input date string.
      Returns:
      The corresponding Date object.
      Throws:
      ParseException - if the string cannot be parsed.
      Since:
      1.0.0
    • dateToString

      public static String dateToString(Date pDate, String pFormat)
      A String that converts a Date object to a string in a specified format.
      Parameters:
      pDate - Date - The date to be converted.
      pFormat - String - The desired date format (e.g., "yyyy-MM-dd").
      Returns:
      The date as a string in the specified format.
      Since:
      1.0.0