title: Java Formatting String to Remove "0" in front of the variable
body: <p>Basically I am having some problem when trying to format the string I retrieved from database. Here is my nested for loop:</p>
  
  <pre><code>for (int count = 0; count &lt; monthStr.length; count++) {
          for (int i = 0; i &lt; trans_list.size(); i++) {
              if (count == Integer.parseInt(trans_list.get(i).getDate())) {
                  expensesSeries.add(x[count], trans_list.get(i)
                          .getAmount());
              } 
              else{
                  expensesSeries.add(x[count], 0);
              }
          }
      }
  </code></pre>
  
  <p>Basically the getDate() will return string in these format: 01,02,03,04 and so on until 12. What I am trying to do is comparing the count which is 1-12, with the string I retrieved. Is there any way to remove the 0 in front of 01,02 from the string? </p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>    boolean setZero = true;
      String[] monthStr = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
              "Aug", "Sep", "Oct", "Nov", "Dec" };
  
      // Creating an XYSeries for Expenses
      XYSeries expensesSeries = new XYSeries("Expenses");
      for (int count = 1; count &lt; 13; count++) {
          for (int i = 0; i &lt; trans_list.size(); i++) {
              if (count == Integer.parseInt(trans_list.get(i).getDate())) {
                  setZero = false;
                  expensesSeries.add(count, trans_list.get(i)
                          .getAmount());
              } 
              if(setZero)
              {
                  expensesSeries.add(count, 0);
                  setZero = true;
              }       
          }
      }
  
      for (int j = 0; j &lt; monthStr.length; j++) {
          multiRenderer.addXTextLabel(j+1, monthStr[j]);
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/lfTxT.png" alt="enter image description here"></p>