title: Left justified number along with percentage % in java
body: <p>I am trying to show number with percentage sign left justified along with other integer and string. For that I am using string format in java. I almost got it but stuck when ten's digit move to hundred digit. For example:</p>
  
  <pre><code>public class Test1 {
  
  public static void main(String args[]){
  int per1= 100,g1=3;
  String name1="AAA PPPP";
  int per2= 55,g2=4;
  String name2="BBB QQQ";
  int per3= 24,g3=7;
  String name3="CCC RRRRR";
  
  System.out.println(String.format("%-3d%% | %02d strike | %s",per1,g1,name1));
  System.out.println(String.format("%-3d%% | %02d strike | %s",per2,g2,name2));
  System.out.println(String.format("%-3d%% | %02d strike | %s",per3,g3,name3));
  
  }
  
  }
  </code></pre>
  
  <p>Currently, the output I m getting is this</p>
  
  <pre><code>100% | 03 strike | AAA PPPP
  55 % | 04 strike | BBB QQQ
  24 % | 07 strike | CCC RRRRR
  </code></pre>
  
  <p>but expected is</p>
  
  <pre><code>100% | 03 strike | AAA PPPP
  55%  | 04 strike | BBB QQQ
  24%  | 07 strike | CCC RRRRR
  </code></pre>
  
  <p>I m badly stuck now. I know its very tricky but still m struggling to get answer. Please help people.</p>