code: private static Integer sysctlGetInt(String sysctlKey) throws IOException {
          Process process = new ProcessBuilder("sysctl", sysctlKey).start();
          try {
              InputStream is = process.getInputStream();
              InputStreamReader isr = new InputStreamReader(is);
              BufferedReader br = new BufferedReader(isr);
              try {
                  String line = br.readLine();
                  if (line.startsWith(sysctlKey)) {
                      for (int i = line.length() - 1; i > sysctlKey.length(); --i) {
                          if (!Character.isDigit(line.charAt(i))) {
                              return Integer.valueOf(line.substring(i + 1, line.length()));
                          }
                      }
                  }
                  return null;
              } finally {
                  br.close();
              }
          } finally {
              if (process != null) {
                  process.destroy();
              }
          }
      }
docs: This will execute <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> with the {@code sysctlKey}
  which is expected to return the numeric value for for {@code sysctlKey}.
  @param sysctlKey The key which the return value corresponds to.
  @return The <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> value for {@code sysctlKey}.