src/java.management/share/classes/java/lang/management/MemoryUsage.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>

@@ -235,17 +235,20 @@
 
     /**
      * Returns a descriptive representation of this memory usage.
      */
     public String toString() {
-        StringBuilder buf = new StringBuilder();
-        buf.append("init = " + init + "(" + (init >> 10) + "K) ");
-        buf.append("used = " + used + "(" + (used >> 10) + "K) ");
-        buf.append("committed = " + committed + "(" +
-                   (committed >> 10) + "K) " );
-        buf.append("max = " + max + "(" + (max >> 10) + "K)");
-        return buf.toString();
+        StringBuilder sb = new StringBuilder();
+        sb.append("init = ").append(init).append('(').append(init >> 10)
+                .append("K) ");
+        sb.append("used = ").append(used).append('(').append(used >> 10)
+                .append("K) ");
+        sb.append("committed = ").append(committed).append('(')
+                .append(committed >> 10).append("K) ");
+        sb.append("max = ").append(max).append('(').append(max >> 10)
+                .append("K)");
+        return sb.toString();
     }
 
     /**
      * Returns a <tt>MemoryUsage</tt> object represented by the
      * given <tt>CompositeData</tt>. The given <tt>CompositeData</tt>