package com.zcxk.core.utils;


import java.text.DecimalFormat;

/**
 * @author Andy
 * @version V1.0
 * @description: Integer工具类
 * @date 2021/7/21
 **/
public class ZoniotIntegerUtils {

    private static  final String PATTERN = "###,###";

    /**
     * @author Andy
     * @description 不为空且 值 != 0
     * @date 9:26 2021/7/21
     * @param value
     * @return boolean
     **/
    public static boolean isNotEmpty(Integer value){
        return !isEmpty(value);
    }

    /**
     * @author Andy
     * @description 为空或值 == 0
     * @date 9:26 2021/7/21
     * @param value
     * @return boolean
     **/
    public static boolean isEmpty(Integer value){
        return value == null || value == 0;
    }

    /**
    * @author Andy
    * @description 1000000格式化为 1,000,000
    * @date 16:38 2021/7/21
    * @param value
    * @return java.lang.String
    **/
    public static String decimalFormat(int value) {
        return new DecimalFormat(PATTERN).format(value);
    }

    /**
    * @author Andy
    * @description 转换int
    * @date 10:33 2021/7/23
    * @param value
    * @return int
    **/
    public static int parseInt(Object value) {
        return value == null ? 0 : Integer.parseInt(value.toString());
    }

    /**
    * 是否相等
    * @author Andy
    * @date 18:33 2021/8/17
    * @param integer1:
    * @param integer2:
    * @return boolean
    **/
    public static boolean equal(Long integer1, Long integer2) {
        if (integer1 == null && integer2 == null) {
            return true;
        }
        if (integer1 == null || integer2 == null) {
            return false;
        }
        return  integer1.equals(integer2);
    }


}
