Originally posted by Layne Lund:
Anyways, is there a way to specify a byte literal, other than an explicit cast?
Layne
Tony Morris
Java Q&A (FAQ, Trivia)
Originally posted by Tony Morris:
No, not even with an explicit cast. This can also be said for the primitive type short. Literals are of type int, long, float, double, boolean, char or String and never anything else.
Originally posted by Joni Salonen:
If the literal is in the range 0-255 (instead of -128-127 when the conversion from int literal to byte is automatic) you can subtract 256 to get the value you want. This is identical to casting to byte.
(I'm referring to assignment conversion)
[ January 22, 2006: Message edited by: Joni Salonen ]
"I'm not back." - Bill Harding, Twister
Originally posted by Layne Lund:
Normally I would create a static variable, but it doesn't seem to bring any benefit in this particular situation since I'm only using it once.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
"I'm not back." - Bill Harding, Twister
And inside of my fortune cookie was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|