views:

60

answers:

1

Hey,

Is there an existing Java library to represent common weights and measures? I would like something which allows you to create objects which represent weight and distances in different units and let you compare them. It wouldn't be too hard to implement myself, but in this case I don't want to re-invent the wheel, since this wheel isn't that interesting! There seems to be something in the Apache Commons sandbox which vaguely fits what I need, though I would prefer something stable.

Edit:

Would it be possible to provide an example of how to define a new unit type in JScience? I am not clear on this from reading the documentation on jscience.org.

+1  A: 

There is the Java Numbers with Unit library on SourceForge: Java Numbers with Unit

Also, you may be interested in JScience, but it is much more involved.

I also found: Java units of measure

Michael Goldshteyn
I am interested in JScience but I can't seem to import javax.units.Unit or javax.quantities.* - I have downloaded and installed JScience, where do I get these packages from?
Peter