code: private void calculateYear()
    {
      long days = _dayOfEpoch;
  
      // shift to using 1601 as a base
      days += (1970 - 1601) * 365 + (1970 - 1601) / 4 - 3;
  
      long n400 = divFloor(days, 400 * 365 + 100 - 3);
      days -= n400 * (400 * 365 + 100 - 3);
  
      long n100 = divFloor(days, 100 * 365 + 25 - 1);
      if (n100 == 4)
        n100 = 3;
      days -= n100 * (100 * 365 + 25 - 1);
  
      long n4 = divFloor(days, 4 * 365 + 1);
      if (n4 == 25)
        n4 = 24;
      days -= n4 * (4 * 365 + 1);
  
      long n1 = divFloor(days, 365);
      if (n1 == 4)
        n1 = 3;
  
      _year = 400 * n400 + 100 * n100 + 4 * n4 + n1 + 1601;
      _dayOfYear = (int) (days - 365 * n1);
  
      _isLeapYear = isLeapYear(_year);
    }
docs: Calculates the year, the dayOfYear and whether this is a leap year
  from the current days since the epoch.