Java examples for File Path IO:Byte Array
set Bit to byte value
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { byte b = 2; int pos = 2; System.out.println(setBit(b, pos)); }/*www . jav a 2 s. c o m*/ /** * * @param b * @param pos * @return */ public static byte setBit(byte b, int pos) { return (byte) (b | (1 << pos)); } }