/**
 * test round grades
 * grade lesss than 38 ->round to 38
 * grade grate than 38 less than 40 ->round to 40
 * if grade is 100 donot need be rounded
 * if grade's first bit is between [0-5] , first bit number need be minused into a number and compare with 3
 * if step 5 unit minus first bit number and result less than 3 , grade's first bit number need be rounded into 5
 * if grade's first bit is between (5,10), first bit number need be minused into a number and compare with 3
 * if step 10 unit minus first bit number and result less than 3 , grade's first bit number need be round into 0 and
 * digit bit number need be rounded into a number steped by plusing 1
 * first bit is defined from right to left
 * @param grades
 * @return
 */
public static List<Integer> gradingStudents(List<Integer> grades){
    if (grades==null){
        return null;
    }
    if (grades.isEmpty()){
        return null;
    }
    if (grades.size()<0 || grades.size()>60){
        return null;
    }
    for (Integer grade : grades) {
        if (grade<0 || grade>100){
            return null;
        }
    }
    ArrayList<Integer> finalSCoreList = new ArrayList<>();
    grades.forEach(e->{
        if (e<38){
            finalSCoreList.add(e);
        } else if (e>=38 && e<=40) {
            e = 40;
            finalSCoreList.add(e);
        }else if (e==100){
            finalSCoreList.add(e);
        } else {
            String s = String.valueOf(e);
            String substring = s.substring(1);
            Integer i = Integer.valueOf(substring);
            if (i>=0 && i<=5){
                String substring1 = s.substring(0, 1);
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append(substring1);
                String string = stringBuilder.toString();
                Integer i1 = Integer.valueOf(string);
                int i2 = 5 - i1;
                if (i2<3){
                    stringBuilder.append("5");
                }else {
                    stringBuilder.append(i);
                }
                finalSCoreList.add(Integer.valueOf(stringBuilder.toString()));
            } else if (i>5 && i<10) {
                String substring1 = s.substring(0, 1);
                StringBuilder stringBuilder = new StringBuilder();
                Integer i1 = Integer.valueOf(substring1);
                int i2 = 10- i;
                if (i2<3){
                    i1+=1;
                    stringBuilder.append(i1);
                    stringBuilder.append(0);
                }else {
                    stringBuilder.append(s);
                }
                String string = stringBuilder.toString();
                finalSCoreList.add(Integer.valueOf(string));
            }
        }
    });
    return finalSCoreList;
}