BinaryWordVectorUtils { public static void convertWordVectorsToBinary(Map<String, float[]> vectors, File binaryTarget) throws IOException { boolean caseless = vectors.keySet().stream() .allMatch(token -> token.equals(token.toLowerCase())); convertWordVectorsToBinary(vectors, caseless, DEFAULT_LOCALE, binaryTarget); }  static void convertWordVectorsToBinary(Map<String, float[]> vectors, File binaryTarget); static void convertWordVectorsToBinary(Map<String, float[]> vectors, boolean aCaseless,
            Locale aLocale, File binaryTarget);  }
@Test public void testConvertWordVectorsToBinary() throws Exception { File binaryTarget = writeBinaryFile(vectors); BinaryVectorizer vec = BinaryVectorizer.load(binaryTarget); assertTrue(vec.contains("t1")); assertTrue(vec.contains("t2")); assertEquals(3, vec.dimensions()); assertEquals(2, vec.size()); assertTrue(vec.isCaseless()); for (String word : vectors.keySet()) { float[] orig = vectors.get(word); float[] conv = vec.vectorize(word); assertTrue("Vectors differ for " + word, Arrays.equals(orig, conv)); } }