Convert unit between metric and imperial in Java

Unit convertion, e.g., Metric to imperial


JSRs (Java Specification Requests)

  1. JSR-275 Units Specification
  2. JSR-363 Units of Measurement API 1.0
  3. JSR-385 Units of Measurement API 2.0 (CURRENT)

Maven packages



  • What is Quantities
  • Initialise it
  • From Kilogram to gram
  • From Metric to imperial
  • CLDR: The Unicode CLDR provides key building blocks for software to support the world’s languages, with the largest and most extensive standard repository of locale data available. see:
Quantity<Mass> kilogram = Quantities.getQuantity(1, Units.KILOGRAM);
Quantity<Mass> gram = Quantities.getQuantity(1, CLDR.GRAM);
Quantity<Mass> pound = Quantities.getQuantity(1, USCustomary.POUND);
Quantity<Mass> ounce = Quantities.getQuantity(1, CLDR.OUNCE);
Quantity<Mass> weight5 = Quantities.getQuantity(1, CLDR.OUNCE_TROY);

Quantity<Mass> kilogramToGram =;
Quantity<Mass> kilogramToPound =;

Quantity<Length> centimetre = Quantities.getQuantity(214, MetricPrefix.CENTI(METRE));