private static void print(int width,boolean alignRight,PrintStream out,Object obj){
  String s=String.valueOf(obj);
  int padLen=width - s.length();
  if (alignRight) {
    pad(padLen,out);
  }
  out.print(s);
  if (!alignRight) {
    pad(padLen,out);
  }
}

private static void print ( int width , boolean alignRight , PrintStream out , Object obj ) { String s = String . valueOf ( obj ) ; int padLen = width - s . length ( ) ; if ( alignRight ) { pad ( padLen , out ) ; } out . print ( s ) ; if ( ! alignRight ) { pad ( padLen , out ) ; } }
equivalent to out . print ( obj ) except it may be padded on the left or right
