DJUNITS - Delft Java UNIT System

DJUNITS is a set of Java classes that make life easier for scientific software writers, modelers, and anyone who uses quantities in their code, by catching many common errors with the use of quantities and units at compile time and some others at runtime.

  • DJUNITS performs automatic conversions between most commonly used units of the same quantity. E.g., conversion of distances from miles to kilometers.
  • DJUNITS stores all values internally in the basic SI unit for that quantity. The value can be converted to any (user-selectable) suitable unit for display.
  • DJUNITS distinguishes absolute and relative values to catch common errors at compile time.
  • DJUNITS ensures that values of the same quantity expressed in different units are correctly added together. E.g. a distance in miles is correctly added to a distance in kilometers.
  • DJUNITS knows or computes the SI type of the result when a value in one unit is multiplied, or divided by another value (that may have another unit).
  • DJUNITS handles Scalars, Vectors and Matrices, as well as quantity tables.
  • DJUNITS stores everything in immutable objects, except for the display unit that can be changed.
  • DJUNITS stores the data for vectors and matrices as float or double values, and using dense or sparse storage.

The djunits-demo project has a number of examples for using DJUNITS.


DJUNITS has an open source BSD 3-clause license.

  • Third party components used in DJUNITS can not have a license that is more restrictive than BSD, Apache, MIT, LGPL, or Eclipse.
  • DJUNITS can be incorporated in part or in full in other products for any use (educational, commercial, whatever).
  • DJUNITS may be extended, evolved by anyone into anything else for any purpose.