blob: f266165e25ea11784d8f27ca067725bc7f61171c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package com.siyeh.igtest.numeric.unnecessary_explicit_numeric_cast;
public class UnnecessaryExplicitNumericCast {
void a(byte b) {
double d = (double) 1;
d = (double) 1.0f;
d = (double) b;
char c = (char) 1;
b = (int)7;
}
double b(int a, byte b) {
return (double)a * (double) b;
}
public static void main(String[] args) {
int i = 10;
double d = 123.0 / (456.0 * (double) i);
}
void unary() {
byte b = 2;
int a[] = new int[(int)b];
final int c = a[((int) b)];
int[] a2 = new int[]{(int)b};
int[] a3 = {(int)b};
final int result = (int) b << 1;
c((int)b);
new UnnecessaryExplicitNumericCast((long)b);
}
void c(int i) {}
UnnecessaryExplicitNumericCast(long i) {}
void c(int cols, int no) {
int rows = (int) Math.ceil((double) no / cols);
}
}
|