/**
  * This is for debug only: print out training matrices in a CSV type format so that the matrices
  * can be examined in a spreadsheet program for debugging purposes.
  */
 private void WriteCSVfile(
     List<String> rowNames, List<String> colNames, float[][] buf, String fileName) {
   p("tagList.size()=" + tagList.size());
   try {
     FileWriter fw = new FileWriter(fileName + ".txt");
     PrintWriter bw = new PrintWriter(new BufferedWriter(fw));
     // write the first title row:
     StringBuffer sb = new StringBuffer(500);
     for (int i = 0, size = colNames.size(); i < size; i++) {
       sb.append("," + colNames.get(i));
     }
     bw.println(sb.toString());
     // loop on remaining rows:
     for (int i = 0, size = buf.length; i < size; i++) {
       sb.delete(0, sb.length());
       sb.append(rowNames.get(i));
       for (int j = 0, size2 = buf[i].length; j < size2; j++) {
         sb.append("," + buf[i][j]);
       }
       bw.println(sb.toString());
     }
     bw.close();
   } catch (IOException ioe) {
     ioe.printStackTrace();
   }
 }
Example #2
1
  public void run() {
    if (ServerSocket == null) return;
    while (true) {
      try {
        InetAddress address;
        int port;
        DatagramPacket packet;
        byte[] data = new byte[1460];
        packet = new DatagramPacket(data, data.length);
        ServerSocket.receive(packet);
        //
        //
        address = packet.getAddress();
        port = packet.getPort();
        System.out.println("get the Client port is: " + port);
        System.out.println("get the data length is: " + data.length);

        FileWriter fw = new FileWriter("Fortunes.txt");
        PrintWriter out = new PrintWriter(fw);
        for (int i = 0; i < data.length; i++) {
          out.print(data[i] + "  ");
        }
        out.close();
        System.out.println("Data has been writen to destination!");

        packet = new DatagramPacket(data, data.length, address, port);
        ServerSocket.send(packet);
        System.out.println("Respond has been made!");
      } catch (Exception e) {
        System.err.println("Exception: " + e);
        e.printStackTrace();
      }
    }
  }
Example #3
1
  // ---------------------------------------------------------------------------
  private void printDependencies() throws TablesawException {
    m_printedDependencies = new HashSet<String>();

    try {
      PrintWriter pw = new PrintWriter(new FileWriter("dependency.txt"));

      pw.println("Targets marked with a * have already been printed");
      // Create a reduced set of stuff to print
      Set<String> ruleNames = new HashSet<String>();

      for (String name : m_nameRuleMap.keySet()) ruleNames.add(name);

      for (String name : m_nameRuleMap.keySet()) {
        Rule rule = m_nameRuleMap.get(name);
        for (String dep : rule.getDependNames()) ruleNames.remove(dep);

        for (Rule dep : rule.getDependRules()) {
          if (dep.getName() != null) ruleNames.remove(dep.getName());
        }
      }

      for (String name : ruleNames) {
        if (!name.startsWith(NAMED_RULE_PREFIX)) printDependencies(name, pw, 0);
      }

      pw.close();
    } catch (IOException ioe) {
      throw new TablesawException("Cannot write to file dependency.txt", -1);
    }
  }
  /**
   * Displays a message in the standard error stream if the value specified
   * by parameter <code>condition<code> is <code>false</code>.
   *
   * @param message  the error message.
   * @param condition  the test condition.
   */
  public static void assertTrue(String message, boolean condition) {

    if (!condition) {
      stdErr.print("** Test failure ");
      stdErr.println(message);
    }
  }
Example #5
0
 /**
  * 1 A (lock) and 0 A (unlock) control locking of objects. This particular operator is pieced
  * together by inspecting AI files, it is not part of the AI7 spec. The Affects all subsequent
  * objects. Bracketing of locking is automatically handled by built-in components (BezShape and
  * subclasses, Group, Layer, and Text components). See the {@code write()} methods of these
  * components.
  *
  * @param isLocked true if subsequent components are visible, false otherwise
  * @param pw <code>PrintWriter</code> for file output
  */
 public static void setLocked(boolean isLocked, PrintWriter pw) {
   if (isLocked) {
     pw.println("1 A");
   } else {
     pw.println("0 A");
   }
 }
Example #6
0
 /**
  * Writes RGB color values to palette to output. Call between beginPalette and endPalette.
  *
  * @param r red component (0..1)
  * @param g green component (0..1)
  * @param b blue component (0..1)
  * @param pw <code>PrintWriter</code> for file output
  */
 public static void paletteRGBCell(double r, double g, double b, PrintWriter pw) {
   String rs = fourPlaces.format(r);
   String gs = fourPlaces.format(g);
   String bs = fourPlaces.format(b);
   pw.println("Pc");
   pw.println(rs + " " + gs + " " + bs + " Xa");
 }
  void writeoneline(String filename1, String filename2) throws IOException {
    // open the file for reading
    BufferedReader file = new BufferedReader(new FileReader(filename1));

    String line = null;
    // send message
    System.out.println("Sending message to the server...");

    while ((line = file.readLine()) != null) {
      String onebyone = line;
      output.println(onebyone);
    }
    file.close();

    // open the file for reading
    PrintWriter file2 = new PrintWriter(new BufferedWriter(new FileWriter(filename2)));
    String line2 = input.readLine();
    // receive a message
    // String response = input.readLine();
    if (line2.isEmpty()) System.out.println("(server did not reply with a message)");
    else {
      System.out.println("Writing to file...:");
      // String line= null;

      file2.println(line2);
      file2.close();
    }
    System.out.println("Done!");
  }
Example #8
0
 /**
  * As of AI 10, visibility of objects is set by 0 Xw (show) and 1 Xw (hide). This particular
  * operator is pieced together by inspecting AI files, it is not part of the AI7 spec. Affects all
  * subsequent objects. Bracketing of visibility is automatically handled by built-in components
  * (BezShape and subclasses, Group, Layer, and Text components). See the {@code write()} methods
  * of these components.
  *
  * @param isVisible true if subsequent components are visible, false otherwise
  * @param pw <code>PrintWriter</code> for file output
  */
 public static void setVisible(boolean isVisible, PrintWriter pw) {
   if (isVisible) {
     pw.println("0 Xw");
   } else {
     pw.println("1 Xw");
   }
 }
 public String getAnswers(List<IN> l, OutputStyle outputStyle, boolean preserveSpacing) {
   StringWriter sw = new StringWriter();
   PrintWriter pw = new PrintWriter(sw);
   printAnswers(l, pw, outputStyle, preserveSpacing);
   pw.flush();
   return sw.toString();
 }
Example #10
0
  public void solve() throws IOException {
    int n = in.nextInt();
    int m = in.nextInt();
    graph = new ArrayList[n + 1];
    color = new int[n + 1];
    Arrays.fill(color, 0);

    for (int i = 0; i < m; i++) {
      int from = in.nextInt();
      int to = in.nextInt();
      if (graph[from] == null) {
        graph[from] = new ArrayList<Integer>();
      }
      graph[from].add(to);
    }

    topSort();
    if (hasCycle) {
      out.print(-1);
      return;
    }

    for (Integer anAnswer : answer) {
      out.printf("%d ", anAnswer);
    }
  }
 public void Contac() {
   String contactos[][] = {{con1, con2, text, con4, con5, con6, con7, con8, con9}};
   Txt = new File(Nombretxt + ".txt");
   try {
     Ficherow = new FileWriter(Txt, true);
     Buw = new BufferedWriter(Ficherow);
     Ficheror = new FileReader(Txt);
     Bur = new BufferedReader(Ficheror);
     Escribir = new PrintWriter(Ficherow);
     String x = "";
     int d = 0;
     String x2 = "";
     while ((x2 = Bur.readLine()) != null) {
       d++;
     }
     for (int i = 0; i < 1; i++) {
       for (int y = 0; y < 9; y++) {
         x = x + contactos[i][y] + "*";
       }
       Escribir.println(x);
     }
     Escribir.close();
     Ficherow.close();
     Buw.close();
     Ficheror.close();
     Bur.close();
   } catch (IOException e) {
   }
 } // Contac
Example #12
0
 public static void clearPlaylist(Playlist pl) throws Exception {
   String s = pl.NAME;
   // (new File(s)).delete();
   (new File(s + ".dec")).delete();
   PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(new File(s))));
   pw.close();
 }
 private void solve() throws Exception {
   int next;
   int state = STATE_NO_WORD;
   int tramCount = 0;
   int trolleybusCount = 0;
   while ((next = bufferedReader.read()) != -1) {
     char ch = (char) next;
     boolean isLetter = ch >= 'a' && ch <= 'z';
     if (!isLetter) {
       if (state == STATE_TRAM) {
         tramCount++;
       } else if (state == STATE_TROLLEYBUS) {
         trolleybusCount++;
       }
       state = STATE_NO_WORD;
     } else {
       int i = 0;
       while (i < rules.length && (rules[i].state != state || rules[i].ch != ch)) {
         i++;
       }
       if (i < rules.length) {
         state = rules[i].next;
       } else {
         state = STATE_UNK_WORD;
       }
     }
   }
   if (tramCount > trolleybusCount) {
     out.println("Tram driver");
   } else if (tramCount < trolleybusCount) {
     out.println("Trolleybus driver");
   } else {
     out.println("Bus driver");
   }
 }
  private void write() {
    // Определяем файл
    File file = new File(fNameOutput);

    try {
      // проверяем, что если файл не существует то создаем его
      if (!file.exists()) {
        file.createNewFile();
      }

      // PrintWriter обеспечит возможности записи в файл
      PrintWriter out = new PrintWriter(file);

      try {
        for (String key : mapKeyWords.keySet()) {
          out.print(key + "=" + mapKeyWords.get(key) + ",");
        }

      } finally {

        out.close();
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
Example #15
0
 public static void main(String[] args) {
   Parser parser = new Parser();
   Label labels = new Label();
   String asmbly;
   int pc = 100;
   try {
     BufferedReader br = new BufferedReader(new FileReader(args[0]));
     String line;
     while ((line = br.readLine()) != null) {
       if (line.contains(":")) labels.fillLabels(line, pc);
       pc++;
     }
   } catch (Exception e) {
     System.out.println("Failed first");
   }
   try {
     BufferedReader br = new BufferedReader(new FileReader(args[0]));
     PrintWriter writer = new PrintWriter("output", "UTF-8");
     String line;
     while ((line = br.readLine()) != null) {
       asmbly = parser.parseLine(line, labels);
       writer.println(asmbly);
     }
     writer.close();
   } catch (Exception e) {
     System.out.println("Failed second");
   }
 }
Example #16
0
 public static void addToPlaylist(File[] filesnames) throws Exception {
   if (logger.isDebugEnabled()) logger.debug("Add to playlist (with parameters - filenames[]).");
   File f = new File(Lecteur.CURRENTPLAYLIST.NAME);
   File Fe =
       new File(
           Lecteur.CURRENTPLAYLIST.NAME.substring(0, Lecteur.CURRENTPLAYLIST.NAME.length() - 19)
               + "wssederdferdtdfdgetrdfdte.pl");
   PrintWriter br = new PrintWriter(new BufferedWriter(new FileWriter(Fe)));
   BufferedReader br1 = new BufferedReader(new FileReader(f));
   String st = null;
   while ((st = br1.readLine()) != null) {
     br.println(st);
   }
   for (int i = 0; i < filesnames.length - 1; i++) {
     br.println(filesnames[i].toString());
   }
   br.print(filesnames[filesnames.length - 1].toString());
   br.close();
   br1.close();
   new File(Lecteur.CURRENTPLAYLIST.NAME).delete();
   (new File(
           Lecteur.CURRENTPLAYLIST.NAME.substring(0, Lecteur.CURRENTPLAYLIST.NAME.length() - 19)
               + "wssederdferdtdfdgetrdfdte.pl"))
       .renameTo(new File(Lecteur.CURRENTPLAYLIST.NAME));
 }
Example #17
0
 public void cutPlaylist() throws Exception {
   if (logger.isDebugEnabled()) logger.debug("Cut Playlist.");
   String st;
   PrintWriter pw =
       new PrintWriter(new BufferedWriter(new FileWriter(new File(this.NAME + ".dec"))));
   BufferedReader br = new BufferedReader(new FileReader(new File(this.NAME)));
   if ((st = br.readLine()) != null) {
     String st2[];
     st = new File(st).toURL().toString();
     st2 = st.split("/");
     StringBuffer stb = new StringBuffer(st2[st2.length - 1]);
     StringBuffer stb2 = stb.reverse();
     String st3 = new String(stb2);
     int i = 0;
     while (st3.charAt(i) != '.') i++;
     String a = st3.substring(i + 1, st3.length());
     pw.print(new StringBuffer(a).reverse());
   }
   while ((st = br.readLine()) != null) {
     pw.println();
     String st2[];
     st = new File(st).toURL().toString();
     st2 = st.split("/");
     StringBuffer stb = new StringBuffer(st2[st2.length - 1]);
     StringBuffer stb2 = stb.reverse();
     String st3 = new String(stb2);
     int i = 0;
     while (st3.charAt(i) != '.') i++;
     String a = st3.substring(i + 1, st3.length());
     pw.print(new StringBuffer(a).reverse());
   }
   pw.close();
   br.close();
 }
Example #18
0
  // ---------------------------------------------------------------------------
  private void printDependencies(String target, PrintWriter pw, int spacing)
      throws TablesawException {
    Rule tr = findTargetRule(target);
    String[] pre;

    for (int I = 0; I < spacing; I++) pw.print("\t");

    List<String> targetList = new ArrayList<String>();
    if (tr != null) {
      for (String name : tr.getDependNames()) {
        targetList.add(name);
      }

      for (Rule r : tr.getDependRules()) {
        if ((r.getName() != null) && (!r.getName().startsWith(NAMED_RULE_PREFIX))) {
          targetList.add(r.getName());
        } else {
          for (String t : r.getTargets()) {
            targetList.add(t);
          }
        }
      }
    }

    if (!m_printedDependencies.add(target) && (targetList.size() != 0)) {
      pw.println(target + "*");
      return;
    }

    pw.println(target);

    for (String t : targetList) printDependencies(t, pw, spacing + 1);
  }
  public static void main(String[] args) throws IOException {
    BufferedReader f = new BufferedReader(new FileReader("beads.in"));
    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("beads.out")));
    int n = Integer.parseInt(f.readLine());
    String s = f.readLine();
    int max = Integer.MIN_VALUE;

    for (int i = 0; i < n; i++) {
      String straight = s.substring(i + 1) + s.substring(0, i + 1);
      char[] beads = straight.toCharArray();
      int temp = 0;
      char color = ' ';
      for (int j = 0; j < n; j++) {
        char currColor = beads[j];
        if (color == ' ' && currColor != 'w') color = currColor;
        if (currColor == color || currColor == 'w') temp++;
        else break;
      }

      color = ' ';
      for (int j = n - 1; j > -1; j--) {
        char currColor = beads[j];
        if (color == ' ' && currColor != 'w') color = currColor;
        if (currColor == color || currColor == 'w') temp++;
        else break;
      }
      max = Math.max(temp, max);
    }
    if (max > n) max = n;
    out.println(max);
    out.close();
    System.exit(0);
  }
 public static void main(String[] args) throws IOException {
   BufferedReader f = new BufferedReader(new FileReader("barn1.in"));
   out = new PrintWriter(new BufferedWriter(new FileWriter("barn1.out")));
   StringTokenizer nstr = new StringTokenizer(f.readLine());
   int m = Integer.parseInt(nstr.nextToken());
   int s = Integer.parseInt(nstr.nextToken());
   occupied = new ArrayList<ArrayList<Integer>>();
   occupied.add(new ArrayList<Integer>());
   for (int i = 0; i < s; i++) {
     try {
       nstr = new StringTokenizer(f.readLine());
       occupied.get(0).add(Integer.parseInt(nstr.nextToken()));
     } catch (NullPointerException e) {
       break;
     }
   }
   Collections.sort(occupied.get(0));
   int bound = m - 1;
   if (occupied.get(0).size() - 1 < bound) {
     bound = occupied.get(0).size() - 1;
   }
   for (int i = 0; i < bound; i++) {
     findMaxCut();
   }
   int total = 0;
   int len = occupied.size();
   for (int i = 0; i < len; i++) {
     ArrayList<Integer> arr = occupied.get(i);
     int len2 = arr.size();
     total += arr.get(len2 - 1) - arr.get(0) + 1;
   }
   out.println(total);
   out.close();
   System.exit(0);
 }
Example #21
0
  protected static void calcTransferCombinations() throws IOException {
    FastScanner in = new FastScanner(System.in);
    PrintWriter out = new PrintWriter(System.out);

    final int PRISONERS_NUMBER = in.nextInt();
    final int MAX_AGGRESSION = in.nextInt();
    final int RANK_LENGTH = in.nextInt();

    int combinations = PRISONERS_NUMBER - RANK_LENGTH + 1;
    int distanceToLastDangerous = RANK_LENGTH;
    int itr = 1;
    while (itr <= PRISONERS_NUMBER) {
      int aggression = in.nextInt();
      if (aggression > MAX_AGGRESSION) {
        if (PRISONERS_NUMBER - itr < RANK_LENGTH) {
          combinations -= Math.min(PRISONERS_NUMBER - itr + 1, distanceToLastDangerous);
          break;
        }

        int left = min(itr, RANK_LENGTH, distanceToLastDangerous);
        combinations -= left;
        distanceToLastDangerous = 0;
      }
      distanceToLastDangerous++;
      itr++;
    }

    out.print(combinations);
    out.flush();
  }
Example #22
0
    public void run() {
      if (Thread.currentThread() == this) {
        //                    Environment.setThreadEnvironment(launcherEnvironment);
        Job.setUserInterface(userInterface);
      }
      try {
        PrintWriter pw = null;
        if (redirect != null) pw = new PrintWriter(redirect);

        // read from stream
        InputStreamReader input = new InputStreamReader(in);
        BufferedReader reader = new BufferedReader(input);
        int read = 0;
        while ((read = reader.read(buf)) >= 0) {
          if (pw != null) {
            pw.write(buf, 0, read);
            pw.flush();
          }
        }

        reader.close();
        input.close();

      } catch (java.io.IOException e) {
        ActivityLogger.logException(e);
      }
    }
  public void solve() throws IOException {
    MyReader in = new MyReader();
    PrintWriter out = new PrintWriter(System.out);

    while (true) {
      int n = in.nextInt();
      if (n == 0) break;
      int m = in.nextInt(), g = in.nextInt(), score[] = new int[m];
      for (int i = 0; i < m; i++) score[i] = in.nextInt();

      Student students[] = new Student[n];
      for (int i = 0; i < n; i++) {
        String name = in.next();
        int cnt = in.nextInt(), totScore = 0;
        for (int j = 0; j < cnt; j++) totScore += score[in.nextInt() - 1];
        students[i] = new Student(name, totScore);
      }
      Arrays.sort(students);

      int pass_cnt = 0;
      for (; pass_cnt < n && students[pass_cnt].getScore() >= g; pass_cnt++) ;
      out.println(pass_cnt);
      for (int i = 0; i < pass_cnt; i++) students[i].print(out);

      out.flush();
    }
  }
Example #24
0
  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    // POST method only used for tracked login operation
    HttpSession session = request.getSession();
    response.setContentType("text/plain");
    PrintWriter out = response.getWriter();

    // Get the username and password from request
    String username = request.getParameter("id");
    String password = request.getParameter("pwd");

    Long id = 0L;
    try {
      id = Long.parseLong(username);
    } catch (Exception ex) {
    }

    if (username != null && password != null) {
      // Login into tracked system
      CTracked ctracked = db.loginTrackedFromMobile(id, password).getResult();

      if (ctracked != null) {
        // Login successful
        out.print("OK," + ctracked.getUsername());
        session.setAttribute("device_id", ctracked.getUsername());
        log.info(ctracked + " : logined!");
      }
    }
  }
Example #25
0
  public static void main(String[] args) throws IOException {
    input.init(System.in);
    PrintWriter out = new PrintWriter(System.out);

    int n = input.nextInt(), k = input.nextInt();
    int[] data = new int[n];
    for (int i = 0; i < n; i++) data[i] = input.nextInt();
    int res = 0;
    for (int i = 0; i < k; i++) {
      HashSet<Integer> set = new HashSet<Integer>();
      for (int j = i; j < n; j += k) set.add(data[j]);
      int max = 1;
      for (int x : set) {
        int count = 0;
        for (int j = i; j < n; j += k) {
          if (data[j] == x) count++;
        }
        max = Math.max(max, count);
      }
      res += (n / k) - max;
    }
    out.println(res);

    out.close();
  }
  static void eliminarLugarFicheroLOC(Lugar lugar) {
    String fichero = lugar.getFicheroLOC();

    try {
      FileReader fr = new FileReader(fichero);
      BufferedReader br = new BufferedReader(fr);

      String linea;
      ArrayList lineas = new ArrayList();

      do {
        linea = br.readLine();
        if (linea != null) {
          if (!linea.substring(0, lugar.nombre.length()).equals(lugar.nombre)) lineas.add(linea);
        } else break;
      } while (true);
      br.close();
      fr.close();

      FileOutputStream fos = new FileOutputStream(fichero);
      PrintWriter pw = new PrintWriter(fos);

      for (int i = 0; i < lineas.size(); i++) pw.println((String) lineas.get(i));
      pw.flush();
      pw.close();
      fos.close();

    } catch (FileNotFoundException e) {
      System.err.println("error: eliminando " + e);

    } catch (IOException e) {
      System.err.println("error: eliminando 2 : " + e);
    }
  }
Example #27
0
  public void printBrowserForm(PrintWriter pw, DAS das) {

    /*-----------------------------------------------------
    // C++ implementation looks like this...

    os << "<b>Sequence " << name() << "</b><br>\n";
    os << "<dl><dd>\n";

    for (Pix p = first_var(); p; next_var(p)) {
        var(p)->print_val(os, "", print_decls);
        wo.write_variable_attributes(var(p), global_das);
        os << "<p><p>\n";
    }

    os << "</dd></dl>\n";
    -----------------------------------------------------*/

    pw.print("<b>Sequence " + getName() + "</b><br>\n" + "<dl><dd>\n");

    wwwOutPut wOut = new wwwOutPut(pw);

    Enumeration e = getVariables();
    while (e.hasMoreElements()) {
      BaseType bt = (BaseType) e.nextElement();

      ((BrowserForm) bt).printBrowserForm(pw, das);

      wOut.writeVariableAttributes(bt, das);
      pw.print("<p><p>\n");
    }
    pw.println("</dd></dl>\n");
  }
  public void run() {
    System.out.println("New Communication Thread Started");

    try {
      PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
      BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

      String inputLine;
      String[] inputTemp = new String[3];

      while ((inputLine = in.readLine()) != null) {
        System.out.println("Server: " + inputLine);

        out.println(inputLine);

        if (inputLine.equals("Bye.")) break;
      }

      out.close();
      in.close();
      clientSocket.close();
    } catch (IOException e) {
      System.err.println("Problem with Communication Server");
      System.exit(1);
    }
  }
  public static void main(String args[]) throws Exception {
    BufferedReader in = new BufferedReader(new FileReader("important.in"));
    PrintWriter out = new PrintWriter("important.out");

    int n = rInt(in.readLine(), 1, MaxN);

    boolean[] t = new boolean[26];

    for (int i = 0; i < n; i++) {
      String s = in.readLine();
      if (s.length() > MaxL) throw new Exception("String is too long");
      char f = checkFormula(s.trim());
      t[f - 'A'] = true;
    }
    ;

    out.println("Yes");

    boolean flag = false;
    for (int i = 0; i < 26; i++)
      if (t[i]) {
        if (flag) out.print(" | ");
        String let = "" + (char) (i + 'A');
        out.print(let + " | ~" + let);
        flag = true;
      }
    ;

    out.close();
  };
Example #30
-1
  public static void main(String[] args) throws IOException {
    int choice;

    PrintWriter pw = new PrintWriter(new FileWriter("csis.txt"));
    Decimal dec = new Decimal(pw);
    Binary bin = new Binary(pw);
    Hexadecimal hex = new Hexadecimal(pw);
    Menu menu = new Menu(pw);

    do {
      menu.display();
      choice = menu.getSelection();
      switch (choice) {
        case 1:
          dec.decToBin();
          break;
        case 2:
          dec.decToHex();
          break;
        case 3:
          bin.binToDec();
          break;
        case 4:
          bin.binToHex();
          break;
        case 5:
          hex.hexToDec();
          break;
        case 6:
          hex.hexToBin();
          break;
      }
    } while (choice != 7);
    pw.close();
  }