TestUtil.java 499 B

1234567891011121314151617181920
  1. package util;
  2. import java.math.BigInteger;
  3. public class TestUtil {
  4. public static void main(String[] args) {
  5. long a = new BigInteger("110101100", 2).longValue();
  6. long subBits = Util.getSubBits(a, 4, 1);
  7. System.out.println(BigInteger.valueOf(subBits).toString(2));
  8. long b = Util.setSubBits(a, subBits, 5, 2);
  9. System.out.println(BigInteger.valueOf(b).toString(2));
  10. byte[] aa = new byte[] { 0 };
  11. byte[] bb = new byte[] { 1 };
  12. Util.setXor(aa, bb);
  13. System.out.println(aa[0]);
  14. }
  15. }