class Confetto {

    protected static Long computeMillisToReachTarget(Float targetVelocity, float initialVelocity,
            float acceleration) {
        if (targetVelocity != null) {
            if (acceleration != 0f) {
                final long time = (long) ((targetVelocity - initialVelocity) / acceleration);
                return time > 0 ? time : 0;
            } else {
                if (targetVelocity < initialVelocity) {
                    return 0L;
                } else {
                    return null;
                }
            }
        } else {
            return null;
        }
    }

}

class ConfettoTest {

    @Test
    public void test_computeMillisToReachTarget() {

        Long time = Confetto.computeMillisToReachTarget(null, 0f, 0f);
        assertNull(time);
        time = Confetto.computeMillisToReachTarget(0f, 10f, 10f);
        assertEquals(0, time.longValue());
        time = Confetto.computeMillisToReachTarget(20f, 10f, 10f);
        assertEquals(1, time.longValue());
        time = Confetto.computeMillisToReachTarget(30f, 0f, 10f);
        assertEquals(3, time.longValue());
        time = Confetto.computeMillisToReachTarget(20f, 10f, 0f);
        assertNull(time);
    }

}