package com.steering.pss.plnsaleord.lenthCal;


/**
 * 取两数之间最小整数
 * @author TJG
 * @version v1.1
 * @date 2017.04.25
 */
public class CoreIsRounded {
//取最小整数
    public static int isRounded(double x,double y) {
        double inMax=0;
        double inMin=0;
        if(x-y>0){
            inMin=y;
            inMax=x;
        }else{
            inMin=x;
            inMax=y;
        }
        if(Mod(inMin,(int)(inMin))==0){
            return (int)(inMin);
        }else if((int)(inMax)-(int)(inMin)==0){
            return 0; 
        }else{
            return (int)(inMin)+1;
        }

    }
    //取最大整数
    public static int isRoundedMax(double x,double y) {
        double inMax=0;
        double inMin=0;
        if(x-y>0){
            inMin=y;
            inMax=x;
        }else{
            inMin=x;
            inMax=y;
        }
        if(Mod(inMax,(int)(inMax))==0){
            return (int)(inMax);
        }else if((int)(inMax)-(int)(inMin)==0){
            return 0; 
        }else{
            return (int)(inMax)+1;
        }

    }
    private static double Mod(double inMin, int i) {
        double remainder = inMin % i;
        return  remainder;
    }
}