mirror of
https://github.com/i2p/i2p.i2p.git
synced 2024-12-06 19:27:00 +01:00
rrd4j: Merge in upstream changes part 5
add file missing from previous checkin
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package org.rrd4j.graph;
|
||||
|
||||
class FindUnit {
|
||||
|
||||
private static final char UNIT_UNKNOWN = '?';
|
||||
private static final char[] UNIT_SYMBOLS = {'y', 'z', 'a', 'f', 'p', 'n', 'µ', 'm', ' ', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'};
|
||||
private static final int SYMBOLS_CENTER = 8;
|
||||
|
||||
private FindUnit() {
|
||||
|
||||
}
|
||||
|
||||
public static char resolveSymbol(double digits) {
|
||||
if (Double.isNaN(digits)) {
|
||||
return UNIT_UNKNOWN;
|
||||
} else {
|
||||
if (((digits + SYMBOLS_CENTER) < UNIT_SYMBOLS.length) && ((digits + SYMBOLS_CENTER) >= 0)) {
|
||||
return UNIT_SYMBOLS[(int) digits + SYMBOLS_CENTER];
|
||||
} else {
|
||||
return UNIT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user