public static String pad(int len){
  char[] dash=new char[len];
  Arrays.fill(dash,' ');
  return new String(dash);
}

public static String pad ( int len ) { char [ ] dash = new char [ len ] ; Arrays . fill ( dash , ' ' ) ; return new String ( dash ) ; }
creates space filled string of given length .
