MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / getShortenedDouble

Method getShortenedDouble

Utils/src/eu/the5zig/util/Utils.java:155–163  ·  view source on GitHub ↗
(double value, int decimals)

Source from the content-addressed store, hash-verified

153 }
154
155 public static String getShortenedDouble(double value, int decimals) {
156 if (decimals == 0)
157 return String.valueOf((int) Math.round(value));
158 double l = 1;
159 for (int i = 0; i < decimals; i++) {
160 l *= 1e1;
161 }
162 return String.valueOf((long) (value * l) / l);
163 }
164
165 public static String getShortenedDouble(double value) {
166 return getShortenedDouble(value, 2);

Callers 15

drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected