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 {} while (true);
64 }
65
66
67 public void foo6() {
68 do {} while (true);
69 }
70
71
72 public void foo7() {
73 do {} while (true);
74 }
75
76
77 public void foo8() {
78 do {} while (true);
79 }
80
81
82 public void foo9() {
83 do {} while (true);
84 }
85 }