blob: 9aa5a5a2dde87893ec7101a431251d966d495dee (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
package com.siyeh.igtest.numeric.implicit_numeric_conversion;
public class ImplicitNumericConversion
{
public ImplicitNumericConversion()
{
}
public void fooBar()
{
final int i = 0;
final char ch = (char) 0;
final long l = 0L;
final double d = 0.0;
float f = (float)1.0;
f = f+1;
f = i;
useInt(i);
useInt('c');
useInt(ch);
useDouble(0);
useDouble(0.0F);
useDouble(-0.0F);
useDouble(i);
useDouble(ch);
useDouble(l);
useDouble(d);
useDouble(f);
useDouble(1.0);
useDouble(1.0F);
useFloat(0);
useFloat(0L);
useFloat(0.0F);
useFloat(i);
useFloat(ch);
useFloat(l);
useFloat(f);
useFloat(1.0F);
useLong(i);
useLong(ch);
useLong(l);
useLong(3L);
useLong(3L);
int j = 0;
j|=l;
System.out.println(j);
}
private int useLong(long l)
{
System.out.println(l);
return (int) l;
}
private int useInt(int i)
{
System.out.println(i);
return i;
}
private void useDouble(double d)
{
System.out.println(d);
}
private void useFloat(float d)
{
System.out.println(d);
}
private void unaryPromotion() {
byte b = 2;
int a[] = new int[b];
a[b] = (byte)1;
}
}
|