Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340089

Simplify SegmentBulkOperations::powerOfProperty

XMLWordPrintable

      The method could be simplified like so:

          static int powerOfPropertyOr(String name, int defaultPower) {
              final String property = GetPropertyAction.privilegedGetProperty(PROPERTY_PATH + name, Integer.toString(defaultPower));
              try {
                  return 1 << Math.clamp(Integer.parseInt(property), 0, Integer.SIZE - 2);
              } catch (NumberFormatException _) {
                  // ignore
              }
              return defaultPower;
          }

            pminborg Per-Ake Minborg
            pminborg Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: