public static Automaton makeDecimalInterval(int min,int max,int digits) throws IllegalArgumentException {
  String x=Integer.toString(min);
  String y=Integer.toString(max);
  if (min > max || (digits > 0 && y.length() > digits)) {
    throw new IllegalArgumentException();
  }
  int d;
  if (digits > 0)   d=digits;
 else   d=y.length();
  StringBuilder bx=new StringBuilder();
  for (int i=x.length(); i < d; i++) {
    bx.append('0');
  }
  bx.append(x);
  x=bx.toString();
  StringBuilder by=new StringBuilder();
  for (int i=y.length(); i < d; i++) {
    by.append('0');
  }
  by.append(y);
  y=by.toString();
  Automaton.Builder builder=new Automaton.Builder();
  if (digits <= 0) {
    builder.createState();
  }
  Collection<Integer> initials=new ArrayList<>();
  between(builder,x,y,0,initials,digits <= 0);
  Automaton a1=builder.finish();
  if (digits <= 0) {
    a1.addTransition(0,0,'0');
    for (    int p : initials) {
      a1.addEpsilon(0,p);
    }
    a1.finishState();
  }
  return a1;
}

public static Automaton makeDecimalInterval ( int min , int max , int digits ) throws IllegalArgumentException { String x = Integer . toString ( min ) ; String y = Integer . toString ( max ) ; if ( min > max || ( digits > 0 && y . length ( ) > digits ) ) { throw new IllegalArgumentException ( ) ; } int d ; if ( digits > 0 ) d = digits ; else d = y . length ( ) ; StringBuilder bx = new StringBuilder ( ) ; for ( int i = x . length ( ) ; i < d ; i ++ ) { bx . append ( '0' ) ; } bx . append ( x ) ; x = bx . toString ( ) ; StringBuilder by = new StringBuilder ( ) ; for ( int i = y . length ( ) ; i < d ; i ++ ) { by . append ( '0' ) ; } by . append ( y ) ; y = by . toString ( ) ; Automaton . Builder builder = new Automaton . Builder ( ) ; if ( digits <= 0 ) { builder . createState ( ) ; } Collection < Integer > initials = new ArrayList < > ( ) ; between ( builder , x , y , 0 , initials , digits <= 0 ) ; Automaton a1 = builder . finish ( ) ; if ( digits <= 0 ) { a1 . addTransition ( 0 , 0 , '0' ) ; for ( int p : initials ) { a1 . addEpsilon ( 0 , p ) ; } a1 . finishState ( ) ; } return a1 ; }
returns a new automaton that accepts strings representing decimal ( base 10 ) non - negative integers in the given interval .
