K
Konrad Viltersten
For converting from int to byte i use the following method.
private int getIntFromByte (byte b) {
if (b >= 0) return (int)b;
return (int)(256 + b); }
I have two questions regarding that.
1. Is there a shorter way to express it (i think i saw some
operators like "<" or "&" or something like that in C, at
least)? Something corresponding to the (a==b)?"a":"b"
as a shorthand for if/else regarding strings...
2. How (timely) effective is the method i use compared
to any alternative (if any can be suggested)?
--
Vänligen
Konrad
---------------------------------------------------
Sleep - thing used by ineffective people
as a substitute for coffee
Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------
private int getIntFromByte (byte b) {
if (b >= 0) return (int)b;
return (int)(256 + b); }
I have two questions regarding that.
1. Is there a shorter way to express it (i think i saw some
operators like "<" or "&" or something like that in C, at
least)? Something corresponding to the (a==b)?"a":"b"
as a shorthand for if/else regarding strings...
2. How (timely) effective is the method i use compared
to any alternative (if any can be suggested)?
--
Vänligen
Konrad
---------------------------------------------------
Sleep - thing used by ineffective people
as a substitute for coffee
Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------