Vecs { static boolean[] toFlags(final List<Optimize> optimizes) { final boolean[] flags = new boolean[optimizes.size()]; for (int i = 0; i < optimizes.size(); ++i) { flags[i] = optimizes.get(i) == Optimize.MAXIMUM; } return flags; } private  Vecs();   }
@Test public void toFlags() { final Random random = new Random(); final boolean[] flags = new boolean[100]; final Optimize[] opts = new Optimize[flags.length]; for (int i = 0; i < flags.length; ++i) { flags[i] = random.nextBoolean(); if (flags[i]) { opts[i] = Optimize.MAXIMUM; } else { opts[i] = Optimize.MINIMUM; } } Assert.assertEquals(Vecs.toFlags(List.of(opts)), flags); }