The following Java code renames files but it does not rename the way I wanted it to. I want the rename files to start from beginning in the directory to the end per the “part” numbers (not the time it was added in inside a particular directory), but it does not do so. Is there an “if” check I can put, like: `if filename.contains(j)` then process this?

```
import java.io.File;

public class RenameFile2 {

    public static void main(String[] args) {

        String absolutePath1 = "1 to 4";
        String absolutePath2 = "6 to 9";
        String absolutePath3 = "10 to 99";
        String absolutePath4 = "100 to 224";

        File dir1 = new File(absolutePath1);
        File dir2 = new File(absolutePath2);
        File dir3 = new File(absolutePath3);
        File dir4 = new File(absolutePath4);

        File[] filesInDir1 = dir1.listFiles();
        File[] filesInDir2 = dir2.listFiles();
        File[] filesInDir3 = dir3.listFiles();
        File[] filesInDir4 = dir4.listFiles();

        int i1 = 1;

        for(File file:filesInDir1) {
            String name = file.getName();
            String newName = "550 00510 00" + i1 + ".pdf";
            String newPath = absolutePath1 + "\\" + newName;
            file.renameTo(new File(newPath));
            System.out.println(name + " changed to " + newName);
            i1++;
        }

        int i2 = 6;
        for(File file:filesInDir2) {
            String name = file.getName();
            String newName = "550 00510 00" + i2 + ".pdf";
            String newPath = absolutePath2 + "\\" + newName;
            file.renameTo(new File(newPath));
            System.out.println(name + " changed to " + newName);
            i2++;
        }

        int i3 = 10;
        for(File file:filesInDir3) {
            String name = file.getName();
            String newName = "550 00510 0" + i3 + ".pdf";
            String newPath = absolutePath3 + "\\" + newName;
            file.renameTo(new File(newPath));
            System.out.println(name + " changed to " + newName);
            i3++;
        }

        int i4 = 100;
        //int j = 99;
        for(File file:filesInDir4) {
            String name = file.getName();
/*            if(name.contains(j))
                {
                }
*/
            String newName = "550 00510 " + i4 + ".pdf";
            String newPath = absolutePath4 + "\\" + newName;
            file.renameTo(new File(newPath));
            System.out.println(name + " changed to " + newName);
            i4++;
            }
        }
    }

```