private boolean isNotOlderThan(String already,String target) throws NumberFormatException {
  if (already == null || already.length() < 1) {
    throw new NumberFormatException("Empty version string");
  }
  StringTokenizer dtok=new StringTokenizer(target,".",true);
  StringTokenizer stok=new StringTokenizer(already,".",true);
  while (dtok.hasMoreTokens() || stok.hasMoreTokens()) {
    int dver;
    int sver;
    if (dtok.hasMoreTokens()) {
      dver=Integer.parseInt(dtok.nextToken());
    }
 else     dver=0;
    if (stok.hasMoreTokens()) {
      sver=Integer.parseInt(stok.nextToken());
    }
 else     sver=0;
    if (sver < dver)     return false;
    if (sver > dver)     return true;
    if (dtok.hasMoreTokens())     dtok.nextToken();
    if (stok.hasMoreTokens())     stok.nextToken();
  }
  return true;
}

private boolean isNotOlderThan ( String already , String target ) throws NumberFormatException { if ( already == null || already . length ( ) < 1 ) { throw new NumberFormatException ( "Empty version string" ) ; } StringTokenizer dtok = new StringTokenizer ( target , "." , true ) ; StringTokenizer stok = new StringTokenizer ( already , "." , true ) ; while ( dtok . hasMoreTokens ( ) || stok . hasMoreTokens ( ) ) { int dver ; int sver ; if ( dtok . hasMoreTokens ( ) ) { dver = Integer . parseInt ( dtok . nextToken ( ) ) ; } else dver = 0 ; if ( stok . hasMoreTokens ( ) ) { sver = Integer . parseInt ( stok . nextToken ( ) ) ; } else sver = 0 ; if ( sver < dver ) return false ; if ( sver > dver ) return true ; if ( dtok . hasMoreTokens ( ) ) dtok . nextToken ( ) ; if ( stok . hasMoreTokens ( ) ) stok . nextToken ( ) ; } return true ; }
see comment in method java . lang . package . iscompatiblewith . return true if already is not older than target . i . e . the target file may be superseded by a file already installed
