Interview Questions

Java - Convert Bytes to KB,MB,GB etc...

import org.apache.commons.io.FileUtils;

public static void main(String[] args){
               
                System.out.println(FileUtils.byteCountToDisplaySize(9978500));
        }

Output:

9 MB

0
No votes yet
Your rating: None