@@ -0,0 +1,545 @@
+package com.github.cschen1205.jp.chap05;%0A%0A/**%0A * Created by memeanalytics on 29/6/17.%0A * You are given two 32-bit numbers, N and M, and two bit positions, i and j%0A * Write a method to set all bits between i and j in N equal to M (e g , M becomes a substring of%0A * N located at i and starting at j)%0A */%0Apublic class Q01 %7B%0A    public static int updateBits(int n, int m, int i, int j) %7B%0A        int max = ~0;%0A%0A        int left = max - (1 %3C%3C j - 1);%0A        int right = (1 %3C%3C i - 1);%0A        %0A        return (n & (left %7C right)) %7C (m %3C%3C i);%0A    %7D%0A%7D%0A

update bits