Format file size

Liferay provides

com.liferay.portal.kernel.util.TextFormatter
, which can be used to format the size of a file given in bytes and thus make it human readable. The relevant method is given with two different signatures;
static String  formatStorageSize(double size, Locale locale)
           
static String  formatStorageSize(int size, Locale locale) 

Leave a Reply