1
2
3
4
5
6
7
8
9
10
11
12
13 package com.puppycrawl.tools.checkstyle.checks.coding.unnecessaryparentheses;
14 public class InputUnnecessaryParenthesesCasts1 {
15 public void valid1() {
16 int x = 23;
17 int y = 44;
18 float k = 12f;
19
20
21 int d = ((int) 100f) + 100 * 2 / ((int) 12.5) + (int) 90f;
22 int p = (int) 110f + 10 * 2 / (int) 10f + (int) 32.2;
23
24 y = (int) (22.2 * 2) / ((int) 8f + 5);
25
26 double arg2 = 23.2;
27 int i = (int) arg2;
28 i = ((int) arg2);
29 p = (int) arg2;
30
31
32 x = (2 * 2 /((int) k));
33 x = 2 * 2 / (int) k;
34
35 int par = ((int)2f * 2) / 4;
36 y = ((Integer) x).hashCode();
37
38 int py = 12;
39 float xy = 40f;
40 int yp = 0;
41 boolean finished = true;
42 boolean result = false;
43
44
45 if(py >= ((int)xy) || (yp ==1 | py >=1)) {
46 xy--;
47 }
48 else if(yp >= (int)xy || (py ==1 | py >=1)) {
49 xy++;
50 }
51
52 if (!((int) xy > yp) && py < 20) {
53 py++;
54 }
55
56 if (35 + (int)'a' == 100) {
57 py++;
58 }
59
60 boolean checkone = true;
61
62 if (!((boolean) checkone)) {
63 checkone = false;
64 }
65 else if ((boolean) checkone) {
66 checkone = !checkone;
67 }
68
69 double limit = 3.2;
70
71 for (int j = 0; j >= ((int) limit); j++) {
72 yp +=1;
73 }
74 for (int j =0; j >= (int) limit; j++) {
75 py--;
76 break;
77 }
78
79
80 for(int j = 10; !finished && !((boolean) (j > 5)) ; j++){
81 break;
82 }
83 for(int jp = 9; !finished || !(boolean) (jp >5); jp++){
84 checkone = false;
85 break;
86 }
87
88
89 long p1 = ((long) ((20 >> 24 ) & 0xFF)) << 24;
90 long p2 = (long) ((20 >> 24 ) & 0xFF) << 24;
91
92
93
94 float f4 = -((float) 42);
95 float f5 = -(float) 90;
96
97
98 long shiftedbytwo = ((long)x) << 2;
99 long shiftedbythree = (long)y << 3;
100
101
102
103 short complement = (short) ~((short) 87777);
104 short bcomplement = (short) ~(short) 90122;
105
106
107 int numSlices1 = (int) Math.max(Math.ceil(((double) 20) / 10), 1);
108 int numSlices2 = (int) Math.max(Math.ceil((double) 20 / 10), 1);
109 }
110 private long getLong1(int start, int end) {
111
112 return (((long) start) << 32) | 0xFFFFFFFFL & end;
113 }
114 private long getLong2(int start, int end) {
115 return ((long) start << 32) | 0xFFFFFFFFL & end;
116 }
117 }