Noob asking for help
5\nOutput "0102304"\nExpected "0102030405"\n\nGetting wrong answer. Not able to figure out what is wrong with my code.\n\n\nclass ZeroEvenOdd {\n    private int
5\nOutput "0102304"\nExpected "0102030405"\n\nGetting wrong answer. Not able to figure out what is wrong with my code.\n\n```\nclass ZeroEvenOdd {\n    private int n;\n    private int oddCount;\n    private int evenCount;\n    private int count;\n    private int number;\n    \n    public ZeroEvenOdd(int n) {\n        this.n = n;\n        this.count = 1;\n        this.number = 1;\n    }\n\n    // printNumber.accept(x) outputs "x", where x is an integer.\n    public void zero(IntConsumer printNumber) throws InterruptedException {\n        while(2 * n > 0) {\n            synchronized(this) {\n                if(count % 2 == 0) {\n                    wait();\n                }\n                count++;\n                printNumber.accept(0);\n                n--;\n                notifyAll();\n            }\n        }\n    }\n\n    public void even(IntConsumer printNumber) throws InterruptedException {\n        while(2 * n > 0) {\n            synchronized(this) {\n                if(count % 2 != 0) {\n                    wait();\n                }\n                if(oddCount == evenCount) {\n                    wait();\n                }\n                evenCount++;\n                count++;\n                printNumber.accept(number++);\n                n--;\n                notifyAll();\n            }\n        }\n    }\n\n    public void odd(IntConsumer printNumber) throws InterruptedException {\n        while(2 * n > 0) {\n            synchronized(this) {\n                if(count % 2 != 0) {\n                    wait();\n                }\n                if(oddCount > evenCount) {\n                    wait();\n                }\n                oddCount++;\n                count++;\n                printNumber.accept(number++);\n                n--;\n                notifyAll();\n            }\n        }\n    }\n}\n```
[]