class HostName {

  String execHostName() {
    String hostname;
    try {
      Process process = new ProcessBuilder(HOSTNAME).start();
      try (InputStream stream = process.getInputStream();
          Scanner s = new Scanner(stream).useDelimiter(START_OF_STRING);) {
        hostname = s.hasNext() ? s.next().trim() : UNKNOWN;
      }
    } catch (IOException hostnameBinaryNotFound) {
      hostname = UNKNOWN;
    }
    return hostname;
  }

}