Converting the following to java snippet `backgro...
# android
c
Converting the following to java snippet
backgroundPaint.setColor(0xffff0000);
to kotlin results in
backgroundPaint.color = -0x10000
. I wouldn't have been able to know how to get that hex color int on my own without the IDE conversion, please what is going on there so I can be able to reproduce it on my own?
l
I think it's the same number written with a different literal
By which I mean: you can also write 0xffff0000
m
backgroundPaint.color = 0xffff0000.toInt()
l
Yes, because if my understanding is correct, 0xffff0000 is the 2's complement of 0x10000, which represent the negation
c
Thanks @msink, but I don't want to cast, I want to write it directly as the IDE did. @Luke how can I be able to write my own, can you link me to some resource I can check to understand how to do that?
google 1