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;
/**
* Utility functions for logging output.
*/
public class LoggingUtil {
public static String fileSizeToString(long n) {
if (n >= 1_000_000_000) return String.format("%.1f GB", n/1_000_000_000.0);
if (n >= 1_000_000) return String.format("%.1f MB", n/1_000_000.0);
if (n >= 1_000) return String.format("%d kb", n/1_000);
if (n == 1) return String.format("%d byte", n);
else return String.format("%d bytes", n);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy