1 package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
2
3 import java.nio.charset.StandardCharsets;
4 import java.util.Scanner;
5
6
7
8
9
10 public void foo1() {
11 do {} while (true);
12 }
13
14
15 public void foo2() {
16 int i = 1;
17 while (i < 5) {
18 String.CASE_INSENSITIVE_ORDER.equals(i + " ");
19 i++;
20 }
21 }
22
23
24 public void foo3() {
25 int i = 1;
26 do {
27 i++;
28 String.CASE_INSENSITIVE_ORDER.equals(i + " ");
29 } while (i < 5);
30 }
31
32
33 public void foo4() {
34 int prog;
35 int user;
36 prog = (int) (Math.random() * 10) + 1;
37 Scanner input = new Scanner(System.in, StandardCharsets.UTF_8);
38 if (input.hasNextInt()) {
39 do {
40 user = input.nextInt();
41 if (user == prog) {
42 String.CASE_INSENSITIVE_ORDER.equals("Good!");
43 } else {
44 if (user > 0 && user <= 10) {
45 String.CASE_INSENSITIVE_ORDER.equals("Bad! ");
46 if (prog < user) {
47 String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours.");
48 } else {
49 String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours");
50 }
51 } else {
52 String.CASE_INSENSITIVE_ORDER.equals("Violation!");
53 }
54 }
55 } while (user != prog);
56 } else {
57 String.CASE_INSENSITIVE_ORDER.equals("Violation!");
58 }
59 String.CASE_INSENSITIVE_ORDER.equals("Goodbye!");
60 }
61
62
63 public void foo5() {
64 do {}
65 while (true);
66 }
67
68
69 public void foo6() {
70 do {}
71 while (true);
72 }
73
74
75 public void foo7() {
76 do {} while (true);
77 }
78
79
80 public void foo8() {
81 do {}
82 while (true);
83 }
84
85
86 public void foo9() {
87 do {} while (true);
88 }
89 }