In a previous article (TextFormatter class) we have seen what is the class TextFormatter and how it works.

Now we'll see another method provided by this class, which can be used to make more human readable the size of a file or, more generally, any value that represents a size in bytes.

The method is called formatKB and it's available with 2 different signatures:

  1. formatKB(double size, Locale locale)
  2. formatKB(int size, Locale locale)

In both versions the method receives a numeric value which represents a byte size and returns a string with the same value converted in Kbytes.