代码优化问题

    private void downFileLimit(FileDownloadManage fileDownloadManage,
                               Long limitStartTime, Long limitEndTime) {
        Long nowTime = System.currentTimeMillis();
        if (limitStartTime != null && limitEndTime != null) {
            if (nowTime > limitStartTime && nowTime < limitEndTime) {
                fileDownloadManage.setSuccess(1);
            }else {
                fileDownloadManage.setSuccess(0);
            }
        }
        if (limitStartTime != null && limitEndTime == null) {
            if (nowTime > limitStartTime) {
                fileDownloadManage.setSuccess(1);
            }
        }
        if (limitEndTime != null && limitStartTime == null) {
            if (nowTime < limitEndTime) {
                fileDownloadManage.setSuccess(1);
            }
        }
    }

这段代码还能如何优化

1 limitStartTime != null && limitEndTime != null 没有必要3个 可以都放在一个判断里面

看晕了,不如用switch试试吧