线程Main中的异常:格式精度不正确

因此,我一直在尝试使此工作正常进行,并且在类似的错误消息中,%f或%d的错误之处是将其用于双精度或整数。我尝试将它们切换出去,但我不断收到这些错误消息。

线程“主”中的异常java.util.IllegalFormatPrecisionException:1         在java.base / java.util.Formatter $ FormatSpecifier.checkInteger(Formatter.java:3138)         在java.base / java.util.Formatter $ FormatSpecifier。(Formatter.java:2874)         在java.base / java.util.Formatter.parse(Formatter.java:2713)         在java.base / java.util.Formatter.format(Formatter.java:2655)         在java.base / java.io.PrintStream.format(PrintStream.java:1053)         在java.base / java.io.PrintStream.printf(PrintStream.java:949)         在Backlog.displayRooms(Backlog.java:45)         在HotelProject.main(HotelProject.java:36)

我能够缩小问题所在的位置(它超过300行,因此无法在此处上传),我希望有人对它出了什么问题有所了解。

import java.util.Random;

class Backlog
{
private int room[][][] = new int [5][6][3];

public Backlog() // Default Constructor
    {
        Random i = new Random();
        for (int u=0; u<3; ++u) // up
            for (int d=0; d<5; ++d) //down
                for (int a=0; a<6; ++a) //across
                {
                    room[d][a][u] = i.nextInt(10) +1;
                    if (room [d][a][u]< 4)
                    {
                        room[d][a][u] = 1; // Occupied
                    }
                    else if (room[d][a][u] >= 4)
                    {
                       room[d][a][u] = 0; // Empty
                    }
                }
    }
    public void displayRooms()
    {
        Random i = new Random();
        for (int d=0; d<5; ++d) // down
        {
            for (int u=0; u<3; ++u) //up
            {    for (int a=0; a<6; ++a) //across
                {
                    room[d][a][u] = i.nextInt(10) +1;
                    if (room [d][a][u]< 4)
                    {
                    room[d][a][u] = 1; // Occupied
                    }
                    else if (room[d][a][u] >= 4)
                    {
                    room[d][a][u] = 0; // Empty
                    }
                    System.out.printf("R# %d%d%d: ", a+1,u,d+1);
                    System.out.printf("%.1d ", room[d][a][u]); // Print across, up, then down 
                }
                System.out.println(" | ");
            }
            System.out.println();
        }
    }