I have 5 variables with the following values.
int john = 0;
int caleb = 0;
int justin = 0;
int loic = 0;
int lala = 0;
DatabaseReference productRef = FirebaseDatabase.getInstance().getReference().child("Product");
    productRef.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
            for (DataSnapshot ds: dataSnapshot.getChildren()){
                String getName = ds.child("name").getValue(String.class);
                if (getName.equals("john")){
                    john++;
                }else if (getName.equals("caleb")){
                    caleb++;
                }else if (getName.equals("justin")){
                    justin++;
                }else if (getName.equals("loic")){
                    loic++;
                }else if (getName.equals("lala")){
                    lala++;
                }
            }
        }
        @Override
        public void onCancelled(@NonNull DatabaseError databaseError) {
        }
    });
after getting data from database, i have:
int john = 3;
int caleb = 15;
int justin = 30;
int loic = 20;
int lala = 0;
what I want is to classify them to have the first, the second, the third ..... according to their values, to have something like that.
justin = 30;
loic = 20;
caleb = 15;
john = 3;
lala = 0;
I'm using java, Android studio. thank you in advance.