Gets the low byte of an integer. - Java java.lang

Java examples for java.lang:byte Array to int

Description

Gets the low byte of an integer.

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int b = 2;
        System.out.println(lowByte(b));
    }/*  ww  w .  j  ava2 s.c o  m*/

    /**
     * Gets the low byte of an integer.
     *
     * @param b the int value
     * @return the lowest 8 bit
     */
    public static byte lowByte(int b) {
        return (byte) (b & 0x000000FF);
    }
}

Related Tutorials