**'org.jscience.physics.amount.Amount'**Java class

## Class Amount<Q extends Quantity>

- java.lang.Object
- org.jscience.physics.amount.Amount<Q>

- All Implemented Interfaces:
- Serializable, Comparable<Measurable<Q>>, Measurable<Q>, javolution.lang.Immutable, javolution.lang.ValueType, Field<Amount<?>>, GroupAdditive<Amount<?>>, GroupMultiplicative<Amount<?>>, Ring<Amount<?>>, Structure<Amount<?>>

public final class Amount<Q extends Quantity>extends Objectimplements Measurable<Q>, Field<Amount<?>>, Serializable, javolution.lang.Immutable

This class represents a determinate or estimated amount for which operations such as addition, subtraction, multiplication and division can be performed (it implements the

`Field`

interface).The nature of an amount can be deduced from its parameterization (compile time) or its

`unit`

(run time). Its precision is given by its`error`

.Amounts can be

`exact`

, in which case they can be expressed as an exact`long`

integer in the amount unit. The framework tries to keep amount exact as much as possible. For example:`Amount<Length> m = Amount.valueOf(33, FOOT).divide(11).times(2); System.out.println(m); System.out.println(m.isExact() ? "exact" : "inexact"); System.out.println(m.getExactValue()); > 6 ft > exact > 6`

Errors (including numeric errors) are calculated using numeric intervals. It is possible to resolve systems of linear equations involving

`matrices`

, even if the system is close to singularity; in which case the error associated with some (or all) components of the solution may be large.By default, non-exact amounts are shown using the plus/minus character (\'\xc2\xb1\') (see

`AmountFormat`

). For example,`"(2.0 \xc2\xb1 0.001) km/s"`

represents a velocity of 2 km/s with an absolute error of \xc2\xb1 1 m/s. Exact amount use an integer notation (no decimal point, e.g.`"2000 m"`

).Operations between different amounts may or may not be authorized based upon the current

`PhysicalModel`

. For example, adding`Amount<Length> and`

`Amount<Duration> is not allowed by the`

`StandardModel`

, but is authorized with the`RelativisticModel`

.`See Also:`

`Wikipedia: Measuring, Serialized Form`

```
```

**Warning:** You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied.
Guests can only view jhplot Java API.
To view the complete description of this class and its methods, please
request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before
visiting this documentation.

```
```