Example usage for java.math BigInteger setBit

List of usage examples for java.math BigInteger setBit

Introduction

In this page you can find the example usage for java.math BigInteger setBit.

Prototype

public BigInteger setBit(int n) 

Source Link

Document

Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit set.

Usage

From source file:org.openhab.binding.ulux.internal.ump.messages.InitMessage.java

@Override
protected void addData(final ByteBuffer buffer) {
    BigInteger initFlags = BigInteger.valueOf(0);

    if (this.reset) {
        initFlags = initFlags.setBit(15);
        initFlags = initFlags.setBit(14);
        initFlags = initFlags.setBit(13);
        initFlags = initFlags.setBit(12);
    }/*  ww w.ja va2 s.c o m*/
    if (this.initRequest) {
        initFlags = initFlags.setBit(6);
    }
    if (this.timeRequest) {
        initFlags = initFlags.setBit(5);
    }

    buffer.putShort(initFlags.shortValue());
    buffer.putShort((short) 0x5AA5);
}