title: Convert the string into stringBuilder in java
body: <p>I have one method which returns the string but I want the data inside the method in StringBuilder and convert it into string then how can I do it?</p>
  
  <pre><code>  public String[][] getDataOfJD(List&lt;JobDescriptionField&gt; jdFields) {
    int i = 0;
    String [][] data = new String[jdFields.size()][];
    for(JobDescriptionField field : jdFields) {
        if (i &gt; 0){
            String messages = "";
            for (String message : field.getMessages()){
               messages += message;
            }
       data [i] = new String[]{field.getTitle(), field.getField(), messages, field.getScore() + ""};
    }
      i++;
      score = score + field.getScore();
    }
    return data;
    }
  </code></pre>
  
  <p>From above example <code>field.getTitle(), field.getField()</code> are of String type And if I want the data in StringBuilder and needs to convert it into string but if I tried to do it by <code>return data.toString</code> then it is giving error.
  Please Help me.</p>