I have written a simple Java program as shown here:
public class Test {
public static void main(String[] args) {
int i1 =2;
int i2=5;
int i1 =2;
int i2=5;
double d = 3 + (double)i1/(double)i2 +2;
if i1/i2 will be fractional value then double will help it to be in fraction instead of int. so now you will the result as you want. or you can also use following code double d = 3+(double)i1/i2+2; In this line i1 is converted into double which will be divided with i2 and result will be in double, so again result will be as 5.4