I am facing issue for order the array list. Let me share you json data first :-

```
[{
"atbez": "PACKING",
"atwtb": "CKD 2X1",

}, {
"atstd": "X",
"atbez": "PACKING",
"atwtb": "LOOSE*"
}, {
"atbez": "PACKING",
"atwtb": "FULL FITTING"
}]

```

Here is my above json data i want to check if **"atstd": "X"** exists then atwtb value Loose will come at top at rest will come after this. My expected output like below:-

```
LOOSE*
CKD 2X1
FULL FITTING

```

I have tried this below code:-

```
if (atbez.contains("PACKING")) {

    linearPacking.setVisibility(View.VISIBLE);

    String atwtb = jsonObject.getString("atwtb");

   packing.add(atwtb);

   if (jsonObject.has("atstd")) {

       String packString = jsonObject.getString("atstd");

       if(packString.equalsIgnoreCase("x")){

         packing.add(0, atwtb);

     }
    }else {
 }
}

```

Please help me how to resolve this issue. Thanks in advance :)