1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package com.puppycrawl.tools.checkstyle.checks.coding.magicnumber;
16
17
18
19
20
21
22
23
24
25
26
27
28 public class InputMagicNumberIgnoreNone1 {
29 public void magicMethod() {
30
31 final int INT_CONST = 101_000;
32 final long LONG_CONST1 = 100_000L;
33 final long LONG_CONST2 = 100l;
34 final float FLOAT_CONST1 = 1.500_0F;
35 final float FLOAT_CONST2 = 1.5f;
36 final double DOUBLE_CONST1 = 1.500_0D;
37 final double DOUBLE_CONST2 = 1.5d;
38 final double DOUBLE_CONST3 = 1.5;
39
40
41 int int_var1 = 1;
42 int int_var2 = (2);
43 long long_var1 = 0L;
44 long long_var2 = 0l;
45 double double_var1 = 0D;
46 double double_var2 = 0d;
47
48 int[] int_array = new int[2];
49
50 int_var1 = 1 + 2;
51 int_var1 += 1;
52 double_var1 = 1.0 + 2.0;
53
54 for (int i = 0; i < 2; i++);
55
56 if (1 < 2);
57
58 if (1.0 < 2.0);
59
60
61 int int_magic1 = 3_000;
62 double double_magic1 = 1.5_0;
63 int int_magic2 = (3 + 4);
64
65 int_array = new int[3];
66
67 int_magic1 += 3;
68 double_magic1 *= 1.5;
69
70 for (int j = 3; j < 5; j += 3) {
71 int_magic1++;
72 }
73
74 if (int_magic1 < 3) {
75 int_magic1 = int_magic1 + 3;
76 }
77
78
79 int octalVar0 = 00;
80 int octalVar8 = 010;
81 int octalVar9 = 011;
82
83 long longOctalVar8 = 0_10L;
84 long longOctalVar9 = 011l;
85
86
87 int hexVar0 = 0x0;
88 int hexVar16 = 0x10;
89 int hexVar17 = 0X011;
90 long longHexVar0 = 0x0L;
91 long longHexVar16 = 0x10L;
92 long longHexVar17 = 0X11l;
93 }
94 }
95
96 interface Blah2IgnoreNone1
97 {
98 int LOW = 5;
99 int HIGH = 78;
100 }
101
102 class ArrayMagicTestIgnoreNone1
103 {
104 private static final int[] NONMAGIC = {3};
105 private int[] magic = {3};
106 private static final int[][] NONMAGIC2 = {{1}, {2}, {3}};
107 }