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