public final class Length extends Number implements Comparable<Length>, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Length.Unit
Represents a given length unit.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Length other) |
double |
doubleValue()
Return the length in meter.
|
boolean |
equals(Object obj) |
float |
floatValue() |
int |
hashCode() |
int |
intValue() |
long |
longValue() |
static Length |
of(double length,
Length.Unit unit)
Create a new
Length object with the given length. |
double |
to(Length.Unit unit)
Return the length in the desired unit.
|
String |
toString() |
byteValue, shortValue
public double doubleValue()
doubleValue
in class Number
public double to(Length.Unit unit)
unit
- the desired length unitNullPointerException
- if the given length unit
is
null
public float floatValue()
floatValue
in class Number
public int compareTo(Length other)
compareTo
in interface Comparable<Length>
public static Length of(double length, Length.Unit unit)
Length
object with the given length.length
- the lengthunit
- the length unitLength
object with the given length.NullPointerException
- if the given length unit
is
null
© 2016-2017 Franz Wilhelmstötter (2017-02-22 21:53)