code: private static long floorDiv(long x, long y) {
      return BigDecimal.valueOf(x).divide(BigDecimal.valueOf(y), 0, RoundingMode.FLOOR).longValue();
    }
docs: Returns the result of dividing x by y rounded using floor.