import javax.measure.Quantity;
import javax.measure.Unit;
import javax.measure.quantity.Length;
import javax.measure.spi.ServiceProvider;
import javax.measure.spi.SystemOfUnits;
public class UnitConversionExample {
public static void main(String[] args) {
Unit<Length> meter = ServiceProvider.current().getSystemOfUnitsService().getSystemOfUnits().getUnit(Length.class, "m");
Quantity<Length> length = QuantityFactory.getDefault().create(10, meter);
Unit<Length> foot = ServiceProvider.current().getSystemOfUnitsService().getSystemOfUnits().getUnit(Length.class, "ft");
Quantity<Length> convertedLength = length.to(foot);
System.out.println(convertedLength);
}
}