title: Is there a way to make it output the values of result in my code?
body: <p>I'm working on my university assignment which requires me to program an eviction algorithm. I am new to programming and have only done Python before. Below is what I have done so far. The code compiles fine but I am not getting the output that I was expected to get.</p>
  
  <p>getting user input and then calling the method for no eviction:</p>
  
  <pre><code>System.out.println();
          System.out.println("Cache content: ");
          print_array(org_cache, size);
          System.out.println("Request sequence: ");
          print_array(request, count);
  
  
          try {
              copy_array(org_cache, cache, size);
              System.out.println("no_evict");
              no_evict(cache, size, request, count);
          }
          catch (Exception e) {
              System.out.println("ERROR: no_evict");
  </code></pre>
  
  <p>the method:</p>
  
  <pre><code>    static void no_evict(int[] cache, int c_size, int[] request, int r_size) {
      int i = 0;
      boolean found = false;
      String result = "";
      String resultHit = "";
      String resultMiss = "";
  
      for(int x = 0; x &lt; r_size; x++) { //for loop goes through every requests
          while(i &lt; c_size || found == false) { //while loop brings a page through every cache value
          if(request[x] == cache[i]){
              found = true;
          } else {
              i += 1;
              }
          }
      if(found == true) {
          result += "h";
          resultHit += "h";
      } else {
          result += "m";
          resultMiss += "m";
          x += 1; //proceeds to next value in request sequence
          }
      }
      System.out.println(result);
      System.out.println(resultHit.length() + "h " + resultMiss.length() + "m");
  }
  </code></pre>
  
  <p>it does not output the result string but instead outputs this:</p>
  
  <pre><code>Cache content:
  20 30 10 5 40
  Request sequence:
  20 30 10
  no_evict
  </code></pre>