All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openlr.binary.writer.IntegerWriter Maven / Gradle / Ivy

The newest version!
package org.openlr.binary.writer;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

class IntegerWriter {
    void write(int value, int numberOfBytes, ByteArrayOutputStream outputStream) throws IOException {
        byte[] bytes = new byte[numberOfBytes];

        for (int i = 0; i < numberOfBytes; i++) {
            bytes[i] = (byte) (value >> (8 * (numberOfBytes - i - 1)));
        }

        outputStream.write(bytes);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy