Top Description Fields Constructors Methods
javax.measure

public final Enum MetricPrefix

extends Enum<MetricPrefix>
implements Prefix
Class Inheritance
All Implemented Interfaces
javax.measure.Prefix

Provides support for the 24 prefixes used in the metric system (decimal multiples and submultiples of units). For example:
import static tech.units.indriya.unit.Units.*;  // Static import (from the RI).
import static javax.measure.MetricPrefix.*; // Static import.
import javax.measure.*;
import javax.measure.quantity.*;
...
Unit<Pressure> HECTOPASCAL = HECTO(PASCAL);
Unit<Length> KILOMETRE = KILO(METRE); 
You could also apply Unit.prefix:
...
Unit<Pressure> HECTOPASCAL = PASCAL.prefix(HECTO);
Unit<Length> KILOMETRE = METRE.prefix(KILO);

Do not use ordinal() to obtain the numeric representation of MetricPrefix. Use getValue() and getExponent() instead.

Implementation Requirements
This is an immutable and thread-safe enum.
Authors
Jean-Marie Dautelle, Werner Keil
Since
2.0
Version
2.3, May 20, 2023
See Also
Wikipedia: Metric Prefix

Field Summary

Modifier and TypeField and Description
public static final MetricPrefix
ATTO

Prefix for 10-18.

public static final MetricPrefix
CENTI

Prefix for 10-2.

public static final MetricPrefix
DECA

Prefix for 101.

public static final MetricPrefix
DECI

Prefix for 10-1.

public static final MetricPrefix
EXA

Prefix for 1018.

private final int
exponent

Exponent part of the associated factor in base^exponent representation.

public static final MetricPrefix
FEMTO

Prefix for 10-15.

public static final MetricPrefix
GIGA

Prefix for 109.

public static final MetricPrefix
HECTO

Prefix for 102.

public static final MetricPrefix
KILO

Prefix for 103.

public static final MetricPrefix
MEGA

Prefix for 106.

public static final MetricPrefix
MICRO

Prefix for 10-6.

public static final MetricPrefix
MILLI

Prefix for 10-3.

public static final MetricPrefix
NANO

Prefix for 10-9.

public static final MetricPrefix
PETA

Prefix for 1015.

public static final MetricPrefix
PICO

Prefix for 10-12.

public static final MetricPrefix
QUECTO

Prefix for 10-30.

public static final MetricPrefix
QUETTA

Prefix for 1030.

public static final MetricPrefix
RONNA

Prefix for 1027.

public static final MetricPrefix
RONTO

Prefix for 10-27.

private final String
symbol

The symbol of this prefix, as returned by getSymbol.

public static final MetricPrefix
TERA

Prefix for 1012.

public static final MetricPrefix
YOCTO

Prefix for 10-24.

public static final MetricPrefix
YOTTA

Prefix for 1024.

public static final MetricPrefix
ZEPTO

Prefix for 10-21.

public static final MetricPrefix
ZETTA

Prefix for 1021.

Constructor Summary

AccessConstructor and Description
private
MetricPrefix(String
the symbol of this prefix.
symbol
,
int
part of the associated factor in base^exponent representation.
exponent
)

Creates a new prefix.

Method Summary

Modifier and TypeMethod and Description
public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-18).
ATTO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-18

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-2).
CENTI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-2

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e1).
DECA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 101

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-1).
DECI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-1

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e1).
DEKA
(Unit<Q>
any unit.
unit
)

US alias for DECA.

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e18).
EXA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 1018

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-15).
FEMTO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-15

public int
getExponent()

Implements javax.measure.Prefix.getExponent.

Exponent part of the associated factor in base^exponent representation.
public String

Returns:

this prefix name, not null.
getName
()

Implements javax.measure.Prefix.getName.

Returns the name of this prefix.
public String

Returns:

this prefix symbol, not null.
getSymbol
()

Implements javax.measure.Prefix.getSymbol.

Returns the symbol of this prefix.
public Integer
getValue()

Implements javax.measure.Prefix.getValue.

Base part of the associated factor in base^exponent representation.
public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e9).
GIGA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 109

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e2).
HECTO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 102

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e3).
KILO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 103

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e6).
MEGA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 106

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-6).
MICRO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-6

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-3).
MILLI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-3

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-9).
NANO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-9

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e15).
PETA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 1015

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-12).
PICO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-12

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-30).
QUECTO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-30

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e30).
QUETTA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 1030

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e27).
RONNA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 1027

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-27).
RONTO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-27

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e12).
TERA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 1012

public static MetricPrefix
public static MetricPrefix[]
public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-24).
YOCTO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-24

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e24).
YOTTA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 1024

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e-21). #see ZEPTO
ZEPTO
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10-21

public static <
type of the quantity measured by the unit.
Q extends Quantity<Q>
>
Unit<Q>

Returns:

unit.times(1e21).
ZETTA
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 1021

Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ATTOback to summary
public static final MetricPrefix ATTO

Prefix for 10-18.

CENTIback to summary
public static final MetricPrefix CENTI

Prefix for 10-2.

See Also
Wikipedia: Centi
DECAback to summary
public static final MetricPrefix DECA

Prefix for 101.

See Also
Wikipedia: Deca
DECIback to summary
public static final MetricPrefix DECI

Prefix for 10-1.

See Also
Wikipedia: Deci
EXAback to summary
public static final MetricPrefix EXA

Prefix for 1018.

exponentback to summary
private final int exponent

Exponent part of the associated factor in base^exponent representation.

FEMTOback to summary
public static final MetricPrefix FEMTO

Prefix for 10-15.

GIGAback to summary
public static final MetricPrefix GIGA

Prefix for 109.

See Also
Wikipedia: Giga
HECTOback to summary
public static final MetricPrefix HECTO

Prefix for 102.

See Also
Wikipedia: Hecto
KILOback to summary
public static final MetricPrefix KILO

Prefix for 103.

See Also
Wikipedia: Kilo
MEGAback to summary
public static final MetricPrefix MEGA

Prefix for 106.

See Also
Wikipedia: Mega
MICROback to summary
public static final MetricPrefix MICRO

Prefix for 10-6.

See Also
Wikipedia: Micro
MILLIback to summary
public static final MetricPrefix MILLI

Prefix for 10-3.

See Also
Wikipedia: Milli
NANOback to summary
public static final MetricPrefix NANO

Prefix for 10-9.

See Also
Wikipedia: Nano
PETAback to summary
public static final MetricPrefix PETA

Prefix for 1015.

PICOback to summary
public static final MetricPrefix PICO

Prefix for 10-12.

QUECTOback to summary
public static final MetricPrefix QUECTO

Prefix for 10-30.

QUETTAback to summary
public static final MetricPrefix QUETTA

Prefix for 1030.

RONNAback to summary
public static final MetricPrefix RONNA

Prefix for 1027.

RONTOback to summary
public static final MetricPrefix RONTO

Prefix for 10-27.

symbolback to summary
private final String symbol

The symbol of this prefix, as returned by getSymbol.

See Also
getSymbol()
TERAback to summary
public static final MetricPrefix TERA

Prefix for 1012.

YOCTOback to summary
public static final MetricPrefix YOCTO

Prefix for 10-24.

YOTTAback to summary
public static final MetricPrefix YOTTA

Prefix for 1024.

ZEPTOback to summary
public static final MetricPrefix ZEPTO

Prefix for 10-21.

ZETTAback to summary
public static final MetricPrefix ZETTA

Prefix for 1021.

Constructor Detail

MetricPrefixback to summary
private MetricPrefix(String symbol, int exponent)

Creates a new prefix.

Parameters
symbol:String

the symbol of this prefix.

exponent:int

part of the associated factor in base^exponent representation.

Method Detail

ATTOback to summary
public static <Q extends Quantity<Q>> Unit<Q> ATTO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-18

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-18).

See Also
ATTO
CENTIback to summary
public static <Q extends Quantity<Q>> Unit<Q> CENTI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-2

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-2).

See Also
CENTI
DECAback to summary
public static <Q extends Quantity<Q>> Unit<Q> DECA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 101

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e1).

See Also
DECA
DECIback to summary
public static <Q extends Quantity<Q>> Unit<Q> DECI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-1

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-1).

See Also
DECI
DEKAback to summary
public static <Q extends Quantity<Q>> Unit<Q> DEKA(Unit<Q> unit)

US alias for DECA.

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e1).

See Also
DECA
EXAback to summary
public static <Q extends Quantity<Q>> Unit<Q> EXA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 1018

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e18).

See Also
EXA
FEMTOback to summary
public static <Q extends Quantity<Q>> Unit<Q> FEMTO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-15

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-15).

See Also
FEMTO
getExponentback to summary
public int getExponent()

Implements javax.measure.Prefix.getExponent.

Exponent part of the associated factor in base^exponent representation.

Returns:int

Doc from javax.measure.Prefix.getExponent.

the exponent part of this prefix.

Annotations
@Override
getNameback to summary
public String getName()

Implements javax.measure.Prefix.getName.

Returns the name of this prefix.

Returns:String

this prefix name, not null.

Annotations
@Override
getSymbolback to summary
public String getSymbol()

Implements javax.measure.Prefix.getSymbol.

Returns the symbol of this prefix.

Returns:String

this prefix symbol, not null.

Annotations
@Override
getValueback to summary
public Integer getValue()

Implements javax.measure.Prefix.getValue.

Base part of the associated factor in base^exponent representation. For metric prefix, this is always 10.

Returns:Integer

Doc from javax.measure.Prefix.getValue.

The prefix value.

Annotations
@Override
GIGAback to summary
public static <Q extends Quantity<Q>> Unit<Q> GIGA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 109

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e9).

See Also
GIGA
HECTOback to summary
public static <Q extends Quantity<Q>> Unit<Q> HECTO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 102

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e2).

See Also
HECTO
KILOback to summary
public static <Q extends Quantity<Q>> Unit<Q> KILO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 103

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e3).

See Also
KILO
MEGAback to summary
public static <Q extends Quantity<Q>> Unit<Q> MEGA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 106

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e6).

See Also
MEGA
MICROback to summary
public static <Q extends Quantity<Q>> Unit<Q> MICRO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-6

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-6).

See Also
MICRO
MILLIback to summary
public static <Q extends Quantity<Q>> Unit<Q> MILLI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-3

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-3).

See Also
MILLI
NANOback to summary
public static <Q extends Quantity<Q>> Unit<Q> NANO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-9

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-9).

See Also
NANO
PETAback to summary
public static <Q extends Quantity<Q>> Unit<Q> PETA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 1015

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e15).

See Also
PETA
PICOback to summary
public static <Q extends Quantity<Q>> Unit<Q> PICO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-12

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-12).

See Also
PICO
QUECTOback to summary
public static <Q extends Quantity<Q>> Unit<Q> QUECTO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-30

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-30).

See Also
QUECTO
QUETTAback to summary
public static <Q extends Quantity<Q>> Unit<Q> QUETTA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 1030

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e30).

See Also
QUETTA
RONNAback to summary
public static <Q extends Quantity<Q>> Unit<Q> RONNA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 1027

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e27).

See Also
RONNA
RONTOback to summary
public static <Q extends Quantity<Q>> Unit<Q> RONTO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-27

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-27).

See Also
RONTO
TERAback to summary
public static <Q extends Quantity<Q>> Unit<Q> TERA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 1012

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e12).

See Also
TERA
valueOfback to summary
public static MetricPrefix valueOf(String name)
valuesback to summary
public static MetricPrefix[] values()
YOCTOback to summary
public static <Q extends Quantity<Q>> Unit<Q> YOCTO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-24

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-24).

See Also
YOCTO
YOTTAback to summary
public static <Q extends Quantity<Q>> Unit<Q> YOTTA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 1024

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e24).

See Also
YOTTA
ZEPTOback to summary
public static <Q extends Quantity<Q>> Unit<Q> ZEPTO(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10-21

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e-21). #see ZEPTO

ZETTAback to summary
public static <Q extends Quantity<Q>> Unit<Q> ZETTA(Unit<Q> unit)

Returns the specified unit multiplied by the factor 1021

Parameters
<Q>
type of the quantity measured by the unit.
unit:Unit<Q>

any unit.

Returns:Unit<Q>

unit.times(1e21).

See Also
ZETTA