List of usage examples for com.google.common.primitives UnsignedLong dividedBy
@CheckReturnValue public UnsignedLong dividedBy(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);//from w w w .j av a 2 s .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; }
From source file:org.apache.nifi.processors.evtx.parser.BinaryReader.java
/** * Reads a timestamp that is the number of hundreds of nanoseconds since Jan 1 1601 * (see http://integriography.wordpress.com/2010/01/16/using-phython-to-parse-and-present-windows-64-bit-timestamps/) * * @return the date corresponding to the timestamp *///from w w w.ja v a 2 s.c o m public Date readFileTime() { UnsignedLong hundredsOfNanosecondsSinceJan11601 = readQWord(); long millisecondsSinceJan11601 = hundredsOfNanosecondsSinceJan11601.dividedBy(UnsignedLong.valueOf(10000)) .longValue(); long millisecondsSinceEpoch = millisecondsSinceJan11601 - EPOCH_OFFSET; return new Date(millisecondsSinceEpoch); }