code: private static boolean commonNeedIncrement(int roundingMode, int qsign,
                                          int cmpFracHalf, boolean oddQuot) {
          switch(roundingMode) {
          case ROUND_UNNECESSARY:
              throw new ArithmeticException("Rounding necessary");
  
          case ROUND_UP: // Away from zero
              return true;
  
          case ROUND_DOWN: // Towards zero
              return false;
  
          case ROUND_CEILING: // Towards +infinity
              return qsign > 0;
  
          case ROUND_FLOOR: // Towards -infinity
              return qsign < 0;
  
          default: // Some kind of half-way rounding
              assert roundingMode >= ROUND_HALF_UP &&
                  roundingMode <= ROUND_HALF_EVEN: "Unexpected rounding mode" + RoundingMode.valueOf(roundingMode);
  
              if (cmpFracHalf < 0 ) // We're closer to higher digit
                  return false;
              else if (cmpFracHalf > 0 ) // We're closer to lower digit
                  return true;
              else { // half-way
                  assert cmpFracHalf == 0;
  
                  switch(roundingMode) {
                  case ROUND_HALF_DOWN:
                      return false;
  
                  case ROUND_HALF_UP:
                      return true;
  
                  case ROUND_HALF_EVEN:
                      return oddQuot;
  
                  default:
                      throw new AssertionError("Unexpected rounding mode" + roundingMode);
                  }
              }
          }
      }
docs: Shared logic of need increment computation.