Top Description Fields Constructors Methods
javax.measure

public final Enum BinaryPrefix

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

Provides support for common binary prefixes to be used by units. For example:
import static systems.uom.unicode.CLDR.*;  // Static import (from Unicode System).
import static javax.measure.BinaryPrefix.*; // Static import.
import javax.measure.*;
import systems.uom.quantity.Information; // (from Systems Quantities)
...
Unit<Information> MEBIT  = MEBI(BIT);
Unit<Information> GIBYTE = GIBI(BYTE); 
You could also apply Unit.prefix:
...
Unit<Information> MEBIT  = BIT.prefix(MEBI);
Unit<Information> GIBYTE = BYTE.prefix(GIBI);

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

Implementation Requirements
This is an immutable and thread-safe enum.
Author
Werner Keil
Since
2.0
Version
2.2, May 20, 2023
See Also
Wikipedia: Binary Prefix

Field Summary

Modifier and TypeField and Description
public static final BinaryPrefix
EXBI

Prefix for 10246.

private final int
exponent

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

public static final BinaryPrefix
GIBI

Prefix for 10243.

public static final BinaryPrefix
KIBI

Prefix for 1024.

public static final BinaryPrefix
MEBI

Prefix for 10242.

public static final BinaryPrefix
PEBI

Prefix for 10245.

private final String
symbol

The symbol of this prefix, as returned by getSymbol.

public static final BinaryPrefix
TEBI

Prefix for 10244.

public static final BinaryPrefix
YOBI

Prefix for 10248.

public static final BinaryPrefix
ZEBI

Prefix for 10247.

Constructor Summary

AccessConstructor and Description
private
BinaryPrefix(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.multiply(1152921504606846976L).
EXBI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10246 (binary prefix).

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.multiply(1073741824).
GIBI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10243 (binary prefix).

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

Returns:

unit.multiply(1024).
KIBI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 1024 (binary prefix).

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

Returns:

unit.multiply(1048576).
MEBI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10242 (binary prefix).

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

Returns:

unit.multiply(1125899906842624L).
PEBI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10245 (binary prefix).

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

Returns:

unit.multiply(1099511627776L).
TEBI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10244 (binary prefix).

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

Returns:

unit.multiply(1208925819614629174706176d).
YOBI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10248 (binary prefix).

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

Returns:

unit.multiply(1152921504606846976d).
ZEBI
(Unit<Q>
any unit.
unit
)

Returns the specified unit multiplied by the factor 10247 (binary prefix).

Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

EXBIback to summary
public static final BinaryPrefix EXBI

Prefix for 10246.

exponentback to summary
private final int exponent

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

GIBIback to summary
public static final BinaryPrefix GIBI

Prefix for 10243.

KIBIback to summary
public static final BinaryPrefix KIBI

Prefix for 1024.

MEBIback to summary
public static final BinaryPrefix MEBI

Prefix for 10242.

PEBIback to summary
public static final BinaryPrefix PEBI

Prefix for 10245.

symbolback to summary
private final String symbol

The symbol of this prefix, as returned by getSymbol.

See Also
getSymbol()
TEBIback to summary
public static final BinaryPrefix TEBI

Prefix for 10244.

YOBIback to summary
public static final BinaryPrefix YOBI

Prefix for 10248.

ZEBIback to summary
public static final BinaryPrefix ZEBI

Prefix for 10247.

Constructor Detail

BinaryPrefixback to summary
private BinaryPrefix(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

EXBIback to summary
public static <Q extends Quantity<Q>> Unit<Q> EXBI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10246 (binary prefix).

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

any unit.

Returns:Unit<Q>

unit.multiply(1152921504606846976L).

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 binary prefix, this is always 1024.

Returns:Integer

Doc from javax.measure.Prefix.getValue.

The prefix value.

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

Returns the specified unit multiplied by the factor 10243 (binary prefix).

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

any unit.

Returns:Unit<Q>

unit.multiply(1073741824).

KIBIback to summary
public static <Q extends Quantity<Q>> Unit<Q> KIBI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 1024 (binary prefix).

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

any unit.

Returns:Unit<Q>

unit.multiply(1024).

MEBIback to summary
public static <Q extends Quantity<Q>> Unit<Q> MEBI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10242 (binary prefix).

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

any unit.

Returns:Unit<Q>

unit.multiply(1048576).

PEBIback to summary
public static <Q extends Quantity<Q>> Unit<Q> PEBI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10245 (binary prefix).

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

any unit.

Returns:Unit<Q>

unit.multiply(1125899906842624L).

TEBIback to summary
public static <Q extends Quantity<Q>> Unit<Q> TEBI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10244 (binary prefix).

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

any unit.

Returns:Unit<Q>

unit.multiply(1099511627776L).

valueOfback to summary
public static BinaryPrefix valueOf(String name)
valuesback to summary
public static BinaryPrefix[] values()
YOBIback to summary
public static <Q extends Quantity<Q>> Unit<Q> YOBI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10248 (binary prefix).

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

any unit.

Returns:Unit<Q>

unit.multiply(1208925819614629174706176d).

ZEBIback to summary
public static <Q extends Quantity<Q>> Unit<Q> ZEBI(Unit<Q> unit)

Returns the specified unit multiplied by the factor 10247 (binary prefix).

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

any unit.

Returns:Unit<Q>

unit.multiply(1152921504606846976d).