Saturday, March 15, 2014

Java and signed stuff

Dont be fooled by the signed and unsigned stuff for example. I do this:

                       short msp=(short)recvBuf[4];    //where recvBuf is a serial port inputstream and i am
                                                                    //capturing the 4th place of that inputstream storing it into short.
                      System.out.println(msp);   //e.g shows -56   but in reality is 200  
                                              but if i do
                        if(msp==200)
                                    //this loop will work
              signed and unsigned is just an illusion in the end the processor only sees the bits and compare

No comments:

Post a Comment