# Integer division in Java

We Are Going To Discuss About Integer division in Java . So lets Start this Java Article.

## Integer division in Java

1. Integer division in Java

They are being divided in integer arithmetics. So dividing integer `a` by integer `b` you get how many times `b` fits into `a`. Also `a % b` will give you a remainder of a division. So `(a / b ) * b + a % b = a`

2. Integer division in Java

They are being divided in integer arithmetics. So dividing integer `a` by integer `b` you get how many times `b` fits into `a`. Also `a % b` will give you a remainder of a division. So `(a / b ) * b + a % b = a`

## Solution 1

They are being divided in integer arithmetics. So dividing integer `a` by integer `b` you get how many times `b` fits into `a`. Also `a % b` will give you a remainder of a division. So `(a / b ) * b + a % b = a`

Original Author Andrei Bardyshev Of This Content

## Solution 2

Java does autoconvert types:

“It autoconverts ints to doubles. It autoconverts shorts and bytes to ints even when no ints are involved, requiring constant annoying casts when you want to do short or byte arithmetic. It autoconverts primitives to wrappers and vice versa for boxing and autoboxing.” – user2357112

Java never casts anything without you specifying it.

But still `integer / integer = integer`.

Also, it does always truncate the result. So if the result would be 0.999999 as float the integer division would still return 0.

Original Author Simon Kirsten Of This Content

## Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.