title: Code shortening with while, for,,,etc?
body: <p>This code is messy and long, that's why I can't modify easly. I try to use <code>while</code>, <code>for</code> loop, et cetera, but I couldn't. Could you plese help me for shorten it. Thank you so much.</p>
  
  <pre><code>String path1 = "/storage/Folder/" + file_name;
  String path2 = Environment.getExternalStorageDirectory().getPath() + "/Folder/" + file_name;
  String path3 = Environment.getExternalStorageDirectory().getPath() + "/Folder2/" + file_name;
  
  File file1 = new File(path1);
  File file2 = new File(path2);
  File file3 = new File(path3);
  
  if (file1.exists()) {
      // do something 1
  } else if (file2.exists()) {
      // do something 2
  } else if (file3.exists()) {
      // do something 3
  } else {
      // do something 4
  }
  </code></pre>
  
  <p>I'm trying like this;</p>
  
  <pre class="lang-java prettyprint-override"><code>String[] path_array = {path1, path2, path3};
  
  for (String current_str : path_array) {
      File fi = new File(current_str);
      if (fi.exists()) {
          // do something
      }
  }
  </code></pre>