-
Notifications
You must be signed in to change notification settings - Fork 4
MathConverterUtils
The MathConverterUtils
class in the software.bluelib.utils.conversion
package provides a set of methods for converting common units and handling date formats. This utility supports conversions such as inches to centimeters, Celsius to Fahrenheit, and string to date, enabling ease of use when working with measurements and date representations.
-
inchesToCentimeters(double)
Converts a given length from inches to centimeters.double centimeters = MathConverterUtils.inchesToCentimeters(5.0);
-
centimetersToInches(double)
Converts a given length from centimeters to inches.double inches = MathConverterUtils.centimetersToInches(12.7);
-
celsiusToFahrenheit(double)
Converts a temperature from Celsius to Fahrenheit.double fahrenheit = MathConverterUtils.celsiusToFahrenheit(25.0);
-
fahrenheitToCelsius(double)
Converts a temperature from Fahrenheit to Celsius.double celsius = MathConverterUtils.fahrenheitToCelsius(77.0);
-
kilometersToMiles(double)
Converts a distance from kilometers to miles.double miles = MathConverterUtils.kilometersToMiles(10.0);
-
milesToKilometers(double)
Converts a distance from miles to kilometers.double kilometers = MathConverterUtils.milesToKilometers(6.2);
-
stringToDate(String, String)
Converts a date in string format to aDate
object based on a specified format.Date date = MathConverterUtils.stringToDate("2023-10-30", "yyyy-MM-dd");
-
dateToString(Date, String)
Converts aDate
object to a string format based on a specified pattern.String dateStr = MathConverterUtils.dateToString(date, "yyyy-MM-dd");
-
Error Handling: Conversion errors are logged with
BaseLogger
at theERROR
level. For instance, if a date string cannot be parsed, an error log is generated. - Utility Design: This class cannot be instantiated, as it contains a private constructor and only static methods.
Variant Loader
Logging
Interfaces
Utility Classes
- Conversion
- Math
- Minecraft