List of usage examples for com.google.common.primitives UnsignedLong mod
@CheckReturnValue public UnsignedLong mod(UnsignedLong val)
From source file:org.jpmml.rexp.RandomForestConverter.java
static <E> List<E> selectValues(List<E> values, Double split, boolean left) { UnsignedLong bits = toUnsignedLong(split.doubleValue()); List<E> result = new ArrayList<>(); for (int i = 0; i < values.size(); i++) { E value = values.get(i);// w ww . j a v a 2s . c om boolean append; // Send "true" categories to the left if (left) { // Test if the least significant bit (LSB) is 1 append = (bits.mod(RandomForestConverter.TWO)).equals(UnsignedLong.ONE); } else // Send all other categories to the right { // Test if the LSB is 0 append = (bits.mod(RandomForestConverter.TWO)).equals(UnsignedLong.ZERO); } // End if if (append) { result.add(value); } bits = bits.dividedBy(RandomForestConverter.TWO); } return result; }