Rather than using 52 swith statements, is it possible to use a loop that can import images?

Atm my code is something like:


Code:
//by K0502201
public void getImg(int counter)
    {
        //inFile = new File(counter + ".bmp")
        inFile = new File("img_" + counter + ".bmp");
        
        try { img = ImageIO.read(inFile); }
        
        catch (IOException e)
        { System.out.println("Image error: " + e); }
    }
that class is called inside a for loop. However, i dnt think im doing this statement correctly as i get a null pointer exception

Any help is greatly aprreciated