java.util.concurrent.ExecutionException:java.lang.NumberFormatException:对于输入字符串:mongodb java 中的“=3”?

java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string:"=3" in mongodb java?

filterConditions 是 {ID>=3,amount<400}

 String[] fCondition = filterConditions.split(",");
        if(fCondition[i].contains(">=")){
            int indx1= fCondition[i].indexOf("=");
            int indx2= fCondition[i].indexOf("=");
            String f1 = fCondition[i].substring(0, indx1);
            String f2 = fCondition[i].substring(indx2);
            fieldList.add(Filters.gte(f1, Integer.valueOf(f2)));
            continue;
        }

f2 赋值更改为 indx2+1 以获得值 3。当前,子字符串从 "=3​​".

获取值
String f2 = fCondition[i].substring(indx2+1);

索引:-

从 1 开始计数。

Returns the index within this string of the first occurrence of the specified character. If a character with value ch occurs in the character sequence represented by this String object, then the index (in Unicode code units) of the first such occurrence is returned.

下面的indexOf returns 4.

int indx2= fCondition[i].indexOf("=");

子串从0开始,当子串为4时,它从=获取值。因此,它必须更改为 index+1.

int indx2= fCondition[i].indexOf("=");