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

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




   
   


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 - 2025 Weber Informatics LLC | Privacy Policy