private static DateTimeFormatter createFormatterForStyle(String style){
  if (style == null || style.length() != 2) {
    throw new IllegalArgumentException("Invalid style specification: " + style);
  }
  int dateStyle=selectStyle(style.charAt(0));
  int timeStyle=selectStyle(style.charAt(1));
  if (dateStyle == NONE && timeStyle == NONE) {
    throw new IllegalArgumentException("Style '--' is invalid");
  }
  return createFormatterForStyleIndex(dateStyle,timeStyle);
}

private static DateTimeFormatter createFormatterForStyle ( String style ) { if ( style == null || style . length ( ) != 2 ) { throw new IllegalArgumentException ( "Invalid style specification: " + style ) ; } int dateStyle = selectStyle ( style . charAt ( 0 ) ) ; int timeStyle = selectStyle ( style . charAt ( 1 ) ) ; if ( dateStyle == NONE && timeStyle == NONE ) { throw new IllegalArgumentException ( "Style '--' is invalid" ) ; } return createFormatterForStyleIndex ( dateStyle , timeStyle ) ; }
select a format from a two character style pattern . the first character is the date style , and the second character is the time style . specify a character of ' s ' for short style , ' m ' for medium , ' l ' for long , and ' f ' for full . a date or time may be ommitted by specifying a style character ' - ' .
