
org.opentripplanner.common.LoggingUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.common;
import java.util.Locale;
/**
* Utility functions for logging output.
*/
public class LoggingUtil {
public static String fileSizeToString(long n) {
if (n >= 1_000_000_000) {
return String.format(Locale.ROOT, "%.1f GB", n / 1_000_000_000.0);
}
if (n >= 1_000_000) {
return String.format(Locale.ROOT, "%.1f MB", n / 1_000_000.0);
}
if (n >= 1_000) {
return String.format(Locale.ROOT, "%d kb", n / 1_000);
}
if (n == 1) {
return String.format(Locale.ROOT, "%d byte", n);
} else {
return String.format(Locale.ROOT, "%d bytes", n);
}
}
/* private methods */
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy