title: What's a good way to create 1MB String?
body: <p>I want to create 1MB String for benchmark,so I writed code as follow:</p>
  
  <pre><code>public final static long KB     = 1024;
  public final static long MB     = 1024 * KB;
  public static void main(String[] args){
      String text_1MB=createString(1*MB);
  }
  static String createString(long size){
      StringBuffer o=new StringBuffer();
      for(int i=0;i&lt;size;i++){
          o.append("f");
      }
      return o.toString();
  }
  </code></pre>
  
  <p>I feel that this method <code>createString</code> is not good and stupid</p>
  
  <p>Any idea to optimize the <code>createString</code> method?</p>