String f1 = (String) o1; String f2 = (String) o2;  int index1 = f1.indexOf( prefix ); int index2 = f2.indexOf( prefix );  if ( index1 < 0 || index2 < 0 ) return 0;  Integer i1 = Integer.valueOf( f1.substring( index1 + prefix.length( ) ) ); Integer i2 = Integer.valueOf( f2.substring( index2 + prefix.length( ) ) ); return i1.compareTo( i2 );
sessionTempDirStr = tempRootDirStr + File.separator + prefix + System.currentTimeMillis( ); file = new File( sessionTempDirStr );
	public static String createSessionTempDir( String tempRootDirStr )	{		String sessionTempDirStr;		final String prefix = "session_";		// second create the seesion temp folder		String[] filesName = new File( tempRootDirStr ).list( );		Arrays.sort( filesName, new Comparator( ) {			public int compare( Object o1, Object o2 )			{				String f1 = (String) o1;				String f2 = (String) o2;				int index1 = f1.indexOf( prefix );				int index2 = f2.indexOf( prefix );				if ( index1 < 0 || index2 < 0 )					return 0;				Integer i1 = Integer.valueOf( f1.substring( index1						+ prefix.length( ) ) );				Integer i2 = Integer.valueOf( f2.substring( index2						+ prefix.length( ) ) );				return i1.compareTo( i2 );			}		} );		// find which extension should be used		int maxIndex = -1;		for ( int i = filesName.length - 1; i >= 0; i-- )		{			int index = filesName[i].indexOf( prefix );			if ( index == 0 )			{				maxIndex = Integer.valueOf( filesName[i].substring( index						+ prefix.length( ) ) ).intValue( );				break;			}		}		maxIndex++;		sessionTempDirStr = tempRootDirStr + File.separator + prefix + maxIndex;		File file = new File( sessionTempDirStr );		file.mkdir( );		return sessionTempDirStr;	}