while (true) {
int allowedErrors = 5;   while (allowedErrors > 0) {
    public void handTileAssignment() {        // if there is just one ssg, give all the tiles to it...        /*         * if (staticSubGraphs.length == 1) {         * staticSubGraphs[0].setNumTiles(rawChip.getTotalTiles()); return; }         */        BufferedReader inputBuffer = new BufferedReader(new InputStreamReader(                                                                              System.in));        int numTilesToAssign = rawChip.getTotalTiles(), num;        SpdStaticStreamGraph current;        for (int i = 0; i < staticSubGraphs.length; i++) {            current = (SpdStaticStreamGraph)staticSubGraphs[i];            int assignedNodes = current.countAssignedNodes();                        //don't do anything for file readers and writers SSGs that do not need a tile            if (assignedNodes < 1)                continue;                        while (true) {                System.out.print("Number of tiles for " + current + " ("                                 + numTilesToAssign + " tiles left, " + assignedNodes                                 + " nodes in subgraph): ");                try {                    num = Integer.valueOf(inputBuffer.readLine()).intValue();                } catch (Exception e) {                    System.out.println("Bad number!");                    continue;                }                if (num <= 0) {                    System.out.println("Enter number > 0!");                    continue;                }                if ((numTilesToAssign - num) < 0) {                    System.out.println("Too many tiles desired!");                    continue;                }                current.setNumTiles(num);                numTilesToAssign -= num;                break;            }        }    }