All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ucar.units.package.html Maven / Gradle / Ivy

Go to download

The ucar.units Java package is for decoding and encoding formatted unit specifications (e.g. "m/s"), converting numeric values between compatible units (e.g. between "m/s" and "knot"), and for performing arithmetic operations on units (e.g. dividing one unit by another, or raising a unit to a power).

The newest version!



   
   


Provides support for parsing and formatting string unit specification,
converting numerical values between compatible units, and performing arithmetic
on units (such as dividing one unit by another).

Examples of Intended Use

The following code will print the string "5 knots is 2.57222 m/s":
UnitFormat format = UnitFormatManager.instance();
Unit meter = format.parse("meter");
Unit second = format.parse("second");
Unit meterPerSecondUnit = meter.divideBy(second);
Unit knot = format.parse("knot");
if (meterPerSecondUnit.isCompatible(knot) {
    System.out.println("5 knots is " +
        knot.convertTo(5, meterPerSecondUnit) +
        ' ' + format.format(meterPerSecondUnit));
}
 




© 2015 - 2024 Weber Informatics LLC | Privacy Policy