Question: ![http://farm4.static.flickr.com/3338/4564960137_0d3c09192d_o.png](https://i.stack.imgur.com/Y2gpf.png)

can we change text in this lightbox

want to change "This site requires that you Connect with Facebook." and "Connect with Facebook to Continue"

Answer: 
For most (if not all) arithmetic operations, Java will assume you want the maximum defined precision. Imagine if you did this:

```
long a = ...;
int b = ...;

long c = a % b + Integer.MAX_VALUE;

```

If Java automatically down-casted `a % b` to an `int`, then the above code would cause an `int` overflow rather than setting `c` to a perfectly reasonable `long` value.

This is the same reason that performing operations with a `double` and an `int` will produce a `double`. It's much safer to up-cast the least-accurate value to a more accurate one. Then if the programmer knows more than the compiler and wants to down-cast, he can do it explicitly.

Update
------

Also, after thinking more about this, I'm guessing most CPU architectures don't have operations that combine 32-bit and 64-bit values. So the 32-bit value would need to be promoted to a 64-bit value just to use it as an argument to the CPU's mod operation, and the result of that operation would be a 64-bit value natively. A down-cast to an `int` would add an operation, which has performance implications. Combining that fact with the idea that you might actually want to keep a `long` value for other operations (as I mention above), it really wouldn't make sense to force the result into an `int` unless the developer explicitly wants it to be one.
> 
> does any one know why Java has a longer type for % than needed?
> 
> 
> 

I don't know for sure. Maybe to make it work exactly the same way as the other multiplicative operators: `*` and `\`. In the [JLS](http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.17) `The type of a multiplicative expression is the promoted type of its operands.` Adding an exception to `long % int` would be confusing.