Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • concerning your edit: yes, i'm aware, but i do not need the entire range of the Integer, because Integers on Arduino are 2 bytes. i'm not planning to send anything bigger than what 2 bytes can represent. Commented Aug 15, 2013 at 7:30
  • You should consider using a Java short instead. Commented Aug 15, 2013 at 7:31
  • Yeah, that's what i thought too, but i wanted to see if it works with Integers as well. Commented Aug 15, 2013 at 7:34
  • You will get the same issues (wrt sign extension) for short and int. The only difference will be that you need to cast the expression to a short. Java's bitwise &, | and ^ operators are only defined as int, int -> int or long, long -> long. Commented Aug 15, 2013 at 7:43