long diffInDays = diffInNanos / (24 * 60 * 60 * 1000 * 1000); // oops! constant overflows and high order bits are lost long diffInDays = diffInNanos / (24 * 60 * 60 * 1000 * 1000L); // correct. First three mults done as int, last as long. long diffInDays = diffInNanos / (24L * 60L * 60L * 1000L * 1000L); // ultra safe. All mults done as long.