### Question:
ALSUtils { public static double computeTargetQui(boolean implicit, double value, double currentValue) { if (implicit) { if (value > 0.0f && currentValue < 1.0) { double diff = 1.0 - Math.max(0.0, currentValue); return currentValue + (value / (1.0 + value)) * diff; } if (value < 0.0f && currentValue > 0.0) { double diff = -Math.min(1.0, currentValue); return currentValue + (value / (value - 1.0)) * diff; } return Double.NaN; } else { return value; } } private  ALSUtils(); static double computeTargetQui(boolean implicit, double value, double currentValue); static float[] computeUpdatedXu(Solver solver,
                                         double value,
                                         float[] Xu,
                                         float[] Yi,
                                         boolean implicit);  }### Answer:
@Test public void testImplicitQui() { assertNaN(ALSUtils.computeTargetQui(true, 0.0, 1.0)); assertNaN(ALSUtils.computeTargetQui(true, 0.0, 0.0)); assertNaN(ALSUtils.computeTargetQui(true, 0.0, -1.0)); assertNaN(ALSUtils.computeTargetQui(true, 0.5, 1.0)); assertNaN(ALSUtils.computeTargetQui(true, -0.5, 0.0)); assertEquals(0.75, ALSUtils.computeTargetQui(true, 1.0, 0.5)); assertEquals(0.25, ALSUtils.computeTargetQui(true, -1.0, 0.5)); for (double d : new double[] { -1.0 , 0.0, 0.5, 1.0, 2.0 }) { assertEquals(d, ALSUtils.computeTargetQui(false, d, 0.0)); } }