app/src/main/java/com/michael/bci/OpenBci.java
public static int interpret16bitAsInt32(byte[] byteArray) {
        int newInt = (
                ((0xFF & byteArray[0]) << 8) |
                        (0xFF & byteArray[1])
        );
        if ((newInt & 0x00008000) > 0) {
            newInt |= 0xFFFF0000;
        } else {
            newInt &= 0x0000FFFF;
        }
        return newInt;
    }
/*
    The accelerometer data is sent as a 16bit signed value.
    We're using a similar scheme to convert these values into 32bit integers in Processing.
    this function is passed a 2 byte array
     */
The accelerometer data is sent as a 16bit signed value.
We're using a similar scheme to convert these values into 32bit integers in Processing.
this function is passed a 2 byte array
The accelerometer data is sent as a 16bit signed value . We ' re using a similar scheme to convert these values into 32bit integers in Processing . this function is passed a 2 byte array
public static int interpret16bitAsInt32(byte[] byteArray) {
        int newInt = (
                ((0xFF & byteArray[0]) << 8) |
                        (0xFF & byteArray[1])
        );
        if ((newInt & 0x00008000) > 0) {
            newInt |= 0xFFFF0000;
        } else {
            newInt &= 0x0000FFFF;
        }
        return newInt;
    }
public static int interpret16bitAsInt32 ( byte [ ] byteArray ) { int newInt = ( ( ( 0xFF & byteArray [ 0 ] ) << 8 ) | ( 0xFF & byteArray [ 1 ] ) ) ; if ( ( newInt & 0x00008000 ) > 0 ) { newInt |= 0xFFFF0000 ; } else { newInt &= 0x0000FFFF ; } return newInt ; }
The accelerometer data is sent as a 16bit signed value.
The accelerometer data is sent as a 16bit signed value .