Java Utililty Methods Decimal From

List of utility methods to do Decimal From

Description

The list of methods to do Decimal From are organized into topic(s).

Method

inttoDecimal(final String intValue)
to Decimal
return Integer.parseInt(intValue, 16);
floattoDecimal(float value)
to Decimal
if (value < 100)
    return value / 100;
while (value > 1) {
    value /= 10;
return value;
voidtoDecimal(int value, byte[] buffer, int offset, int length, int itemLength, boolean packed)
Converts a value to DECIMAL or PACF format, writing it into the buffer at the specified position.
int bufferIndex = offset + itemLength - 1;
if (value >= 0) {
    if (packed)
        buffer[bufferIndex] = 0xF;
    else
        buffer[bufferIndex] = 0xC;
} else {
    value = -value;
...
StringtoDecimal(long val, int places)
to Decimal
StringBuffer buf = new StringBuffer(10 + places);
while (places > 0) {
    buf.append(val % 10);
    places--;
    val = val / 10;
    if (places == 0)
        buf.append('.');
buf.reverse();
return val + buf.toString();
floattoDecimal(String coord)
Converts degree minute second gps coordinate to decimal coordinate form
int firstDec = coord.indexOf(".");
int lastDec = coord.lastIndexOf(".");
float deg = Float.parseFloat(coord.substring(0, firstDec));
float min = Float.parseFloat(coord.substring(firstDec + 1, lastDec));
float sec = Float.parseFloat(coord.substring(lastDec + 1, coord.length()));
if (deg > 0) {
    return (deg + (min / 60 + sec / 3600));
} else {
...
inttoDecimal(String number)
to Decimal
number = number.toUpperCase();
int decimal = 0;
char lastChar = 0;
for (int index = 0; index < number.length(); index++) {
    char c = number.charAt(index);
    switch (c) {
    case 'I':
        decimal += 1;
...