The UCAR Units Java package, part of NetCDF Java, 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, raising a unit to a power).
http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/