@Test public void testGetNumberMask() { int mask; byte[] array; array = new byte[] {1,2,3,4,5}; mask = GameMatrixImpl.getNumberMask(array); assertEquals(2+4+8+16+32, mask); array = new byte[] {1,1,3,4,5}; mask = GameMatrixImpl.getNumberMask(array); assertEquals(2+8+16+32, mask); array = new byte[] {1,1,1,4,5}; mask = GameMatrixImpl.getNumberMask(array); assertEquals(2+16+32, mask); array = new byte[] {0,0,0,4,5}; mask = GameMatrixImpl.getNumberMask(array); assertEquals(16+32, mask); }
protected static int getNumberMask(final byte[] data) { int currentMask = 0; for (int i = 0; i < data.length; i++) { currentMask |= 1 << data[i]; } return currentMask & (~1); }
GameMatrixImpl implements Cloneable, BitFreeMatrixInterface { protected static int getNumberMask(final byte[] data) { int currentMask = 0; for (int i = 0; i < data.length; i++) { currentMask |= 1 << data[i]; } return currentMask & (~1); } }
GameMatrixImpl implements Cloneable, BitFreeMatrixInterface { protected static int getNumberMask(final byte[] data) { int currentMask = 0; for (int i = 0; i < data.length; i++) { currentMask |= 1 << data[i]; } return currentMask & (~1); } GameMatrixImpl(); }
GameMatrixImpl implements Cloneable, BitFreeMatrixInterface { protected static int getNumberMask(final byte[] data) { int currentMask = 0; for (int i = 0; i < data.length; i++) { currentMask |= 1 << data[i]; } return currentMask & (~1); } GameMatrixImpl(); @Override final void setAll(final byte[][] initializationData); @Override final void clear(); @Override final byte get(final int row, final int column); @Override void set(final int row, final int column, final byte value); @Override int getSetCount(); @Override final byte[][] getArray(); @Override final String toString(); @Override int hashCode(); @Override final boolean equals(final Object obj); @Override Object clone(); @Override final boolean isValid(); @Override int getFreeMask(
            final int row,
            final int column); @Override final boolean canSet(
            final int row,
            final int column,
            final byte value); }
GameMatrixImpl implements Cloneable, BitFreeMatrixInterface { protected static int getNumberMask(final byte[] data) { int currentMask = 0; for (int i = 0; i < data.length; i++) { currentMask |= 1 << data[i]; } return currentMask & (~1); } GameMatrixImpl(); @Override final void setAll(final byte[][] initializationData); @Override final void clear(); @Override final byte get(final int row, final int column); @Override void set(final int row, final int column, final byte value); @Override int getSetCount(); @Override final byte[][] getArray(); @Override final String toString(); @Override int hashCode(); @Override final boolean equals(final Object obj); @Override Object clone(); @Override final boolean isValid(); @Override int getFreeMask(
            final int row,
            final int column); @Override final boolean canSet(
            final int row,
            final int column,
            final byte value);  }