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