private int[] parseYMD(String string){
  string=string.trim();
  try {
    if (string.charAt(4) != '-' || string.charAt(7) != '-') {
      throw new IllegalArgumentException("date must be yyyy-MM-dd");
    }
    int[] ymd=new int[3];
    ymd[0]=Integer.valueOf(string.substring(0,4));
    ymd[1]=Integer.valueOf(string.substring(5,7));
    ymd[2]=Integer.valueOf(string.substring(8,10));
    return ymd;
  }
 catch (  NumberFormatException ex) {
    throw new IllegalArgumentException("date must be yyyy-MM-dd",ex);
  }
}

private int [ ] parseYMD ( String string ) { string = string . trim ( ) ; try { if ( string . charAt ( 4 ) != '-' || string . charAt ( 7 ) != '-' ) { throw new IllegalArgumentException ( "date must be yyyy-MM-dd" ) ; } int [ ] ymd = new int [ 3 ] ; ymd [ 0 ] = Integer . valueOf ( string . substring ( 0 , 4 ) ) ; ymd [ 1 ] = Integer . valueOf ( string . substring ( 5 , 7 ) ) ; ymd [ 2 ] = Integer . valueOf ( string . substring ( 8 , 10 ) ) ; return ymd ; } catch ( NumberFormatException ex ) { throw new IllegalArgumentException ( "date must be yyyy-MM-dd" , ex ) ; } }
parse yyyy - mm - dd into a 3 element array [ yyyy , mm , dd ] .
