package com.palatform.yijia;

import org.apache.commons.codec.digest.DigestUtils;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;

public class test {

    public static void main(String[] args) {
//        byte[] digesta = {0, 1, 0, 1};
//        byte[] digestb = {0, 0, 0, 1};
//        boolean equal = test.isEqual(digesta, digestb);
//        System.out.println(equal);
        //DigestUtils.sha1();

//        BigDecimal receivableAmt_b =new BigDecimal(200);
//        BigDecimal discountAmt_b = new BigDecimal(13);
//        BigDecimal gasoilDiscountAmt_b = new BigDecimal(13.56);
//
//        BigDecimal discountAmt = receivableAmt_b.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b);
//        discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
//        System.out.println(discountAmt);

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());   //获取当前时间
        int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
        System.out.println(day_Week);
        day_Week= day_Week-1;     //减一原因：数据库存的下标从零开始
        String currentTime = String.valueOf(day_Week);
        System.out.println(currentTime);
        int day_month = calendar.get(Calendar.DAY_OF_MONTH);
        day_month = day_month-1;        //减一原因：数据库存的下标从零开始
        currentTime = String.valueOf(day_month); //当前时间
        System.out.println(currentTime);
    }



    public static boolean isEqual(byte[] digesta, byte[] digestb) {
        if (digesta.length != digestb.length) {
            return false;
        }

        int result = 0;
        // time-constant comparison
        for (int i = 0; i < digesta.length; i++) {
            result |= digesta[i] ^ digestb[i];
            System.out.println(digesta[i] ^ digestb[i]);
            //System.out.println(result);
        }
        return result == 0;
    }



}
