Skip to content

Commit 414b1ca

Browse files
Convert MB to GB at 1024 MB (#2464)
1 parent b16ccf4 commit 414b1ca

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

core/src/main/java/com/predic8/membrane/core/interceptor/administration/DynamicAdminPageInterceptor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,14 @@ public Response handleSystemRequest(final Map<String, String> params, String rel
270270
static final int mb = 1024*1024;
271271
final DecimalFormat formatter = new DecimalFormat("#.00");
272272

273-
private String formatMemoryValue(float value){
274-
float newValue = value / (float)mb;
273+
private String formatMemoryValue(float value) {
274+
float newValue = value / (float) mb;
275275

276276
String unit = "MB";
277-
if(newValue > 1024)
277+
if (newValue >= 1024f) {
278+
newValue /= 1024f;
278279
unit = "GB";
280+
}
279281

280282
return formatter.format(newValue) + " " + unit;
281283
}

0 commit comments

Comments
 (0)