No, you are not getting what you want; you are getting what arithmetic gives you. Do this:
int a = 18 / 12;
int b = 18 % 12;
double c = 18d / 12d;
If you wanted not what you get, you need to control yourself, not the code. Needs explanation of what you get?