src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java
changeset 52850 f527b24990d7
parent 52334 a181612f0715
child 52901 3ba9ff4d4aaf
equal deleted inserted replaced
52849:eef755718cb2 52850:f527b24990d7
   100             this.amount = amount;
   100             this.amount = amount;
   101         }
   101         }
   102     }
   102     }
   103 
   103 
   104     public static String formatBytes(long bytes, String separation) {
   104     public static String formatBytes(long bytes, String separation) {
       
   105         if (bytes == 1) {
       
   106             return "1 byte";
       
   107         }
   105         if (bytes < 1024) {
   108         if (bytes < 1024) {
   106             return bytes + " bytes";
   109             return bytes + " bytes";
   107         }
   110         }
   108         int exp = (int) (Math.log(bytes) / Math.log(1024));
   111         int exp = (int) (Math.log(bytes) / Math.log(1024));
   109         char bytePrefix = "kMGTPE".charAt(exp - 1);
   112         char bytePrefix = "kMGTPE".charAt(exp - 1);