public static long periodEnd(long now,long period){
  LocalDateTime time=LocalDateTime.ofEpochSecond(now / 1000,0,ZoneOffset.UTC);
  long endTime=periodEnd(now,period,time);
  return endTime;
}

public static long periodEnd ( long now , long period ) { LocalDateTime time = LocalDateTime . ofEpochSecond ( now / 1000 , 0 , ZoneOffset . UTC ) ; long endTime = periodEnd ( now , period , time ) ; return endTime ; }
calculates the next period end . the calculation is in local time .
