Work on a personal project in Java

>work on a personal project in Java
>notice arithmetics start to spew out shit at one point
>started debugging
>245 / 255 * 235 evaluates to 0 in Java
What the actual fuck?

>2016
>sublime text
PLEB
L
E
B

are you sure it's java and not just shitty intellisense?

Poo in loo Rajeet.

>why do I have to care about data types?!
Have you considered using Python or PHP? It tries to cater to your kind.

>doesn't understand integer arithmetic
>blames it on java

WELCOME SUMMER

YOU MUST BE 18+ TO USE Sup Forums

GET THE FUCK OUT

Moron

install gentoo

integer division friendo

245/255 floors to 0 and you can do the rest

At least this is better than RX480 thread #90000

I have those threads filtered though. You can't filter OP's kind of stupidity

it's about on par

245/255 will be casted to 0 since it's an integer division.

>casted

so since you're an absolute fuckwit and have no experience in programming whatsoever, it'd be a dick move to not teach you something:
if you want to use a number as a float, you can use "245f" instead of 245 (similarly 245l will be long)
if you use 245.0, it is double

Add .0 at the end of the numbers to make them floating-point.

That is shit code and you don't understand what you're doing. I recommend you read a book, friendo

>245f
is that typecasting?

Thanks, got it now.

No, that declares a float literal. A cast would be

(float)245

not really. casting means taking one thing and making it something else. 245f just initializes that number to be float. There is never an integer representation of 245 made. But in a more semantic sense, you might call it casting

Am I the only one that would fix this by changing it to 245 * 235 / 255 to keep the math integer based?
I guess AVR has changed me.

Yes, because that still doesn't get the answer OP wants.

this implies that OP actually wanted an integer back.

OP didn't specify. I assumed he just wanted a non-zero answer

If he's surprised by getting zero from that expression he clearly wanted a floating point answer.

this