@Test public void maxSign() { assertEquals(0xffffffff,IntUtils.maxUnsigned(32)); }
public static int maxUnsigned(int numBits) { if (numBits > 32) { throw new IllegalArgumentException("integer overflow"); } if (numBits == 0) return 0; if (numBits == 32) return 0xffffffff; return (0b1 << (numBits)) -1; }
IntUtils { public static int maxUnsigned(int numBits) { if (numBits > 32) { throw new IllegalArgumentException("integer overflow"); } if (numBits == 0) return 0; if (numBits == 32) return 0xffffffff; return (0b1 << (numBits)) -1; } }
IntUtils { public static int maxUnsigned(int numBits) { if (numBits > 32) { throw new IllegalArgumentException("integer overflow"); } if (numBits == 0) return 0; if (numBits == 32) return 0xffffffff; return (0b1 << (numBits)) -1; } private  IntUtils(); }
IntUtils { public static int maxUnsigned(int numBits) { if (numBits > 32) { throw new IllegalArgumentException("integer overflow"); } if (numBits == 0) return 0; if (numBits == 32) return 0xffffffff; return (0b1 << (numBits)) -1; } private  IntUtils(); static Long unsignedIntToLong(int value); static int setMaskedBits(int wholeElement,int mask, int value); static int getFromMask(int unmasked, int mask); static int setMaskedBitsLE(int wholeElement, int mask, int value); static int setMaskedBitsLE(int wholeElement, int mask, int value, int numBits); static int getFromMaskLE(int unmasked, int mask, int numBits); static int maxValueThatFits(int mask); static int maxSigned(int numBits); static int maxUnsigned(int numBits); }
IntUtils { public static int maxUnsigned(int numBits) { if (numBits > 32) { throw new IllegalArgumentException("integer overflow"); } if (numBits == 0) return 0; if (numBits == 32) return 0xffffffff; return (0b1 << (numBits)) -1; } private  IntUtils(); static Long unsignedIntToLong(int value); static int setMaskedBits(int wholeElement,int mask, int value); static int getFromMask(int unmasked, int mask); static int setMaskedBitsLE(int wholeElement, int mask, int value); static int setMaskedBitsLE(int wholeElement, int mask, int value, int numBits); static int getFromMaskLE(int unmasked, int mask, int numBits); static int maxValueThatFits(int mask); static int maxSigned(int numBits); static int maxUnsigned(int numBits); static final int BYTES; }