Java 某个日期n天之后的日期 BigInteger

	public static String nextDate(int day,String sDate) throws ParseException{
		SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd");
		Calendar now = Calendar.getInstance();
		Date date = df2.parse(sDate);
		//System.out.println(date);
		int day_next = day;
		
		BigInteger big1 = new BigInteger( (24 * 60 * 60 * 1000) + "" );
		BigInteger big2 = new BigInteger( day_next + "" );
		
		BigInteger n = big1.multiply(big2);
		
		//System.out.println( big1.multiply(big2) );
		String ss = df2.format( date.getTime() + Long.parseLong(n+"") );
		//System.out.println(ss);
		return ss;
	}

 

************************************

		
		BigInteger big1 = new BigInteger( "2592000" );
		BigInteger big2 = new BigInteger( "1000" );
				
		BigInteger n = big1.multiply(big2);
		System.out.println(n);
System.out.println(2592000 * 1000 );
		

输出结果:

2592000000
-1702967296

你可能感兴趣的:(BigInteger,java)