title: FileInputStream returns null
body: <p>I have two methods, both using FileInputStream Objects.
  The First one returns expected value. This method works fine.
  But the Second method returns nothing. The value passed to the second method is not null.
  I need to get the hexadecimal format of the files passed to methods.
  Why is it so? Kindly Explain.
  Here is my code</p>
  
  <pre><code>public String binaryFile1(File file1){
          try{
          stringBuilder1=new StringBuilder();
          is1=new FileInputStream(file1);
          while(b!=-1){
              counter++;
              b=is1.read();
              String s = Integer.toHexString(b).toUpperCase();
          if (s.length() == 1) {
              stringBuilder1.append('0');
          }
              if(counter%5==0){
                 stringBuilder1.append(s).append("\n");
                 counter=0;
              }else
                  stringBuilder1.append(s).append(' ');
  
          }
          is1.close();
          }catch(Exception e){
              e.printStackTrace();
          }
  
          return stringBuilder1.toString();
  }
  
  
  public String binaryFile2(File file2){
          try{
          stringBuilder2=new StringBuilder();
          is2=new FileInputStream(file2);
          while(b!=-1){
              counter++;
              b=is2.read(); //Here b does not get any content assigned.
              String s = Integer.toHexString(b).toUpperCase();
          if (s.length() == 1) {
              stringBuilder2.append('0');
          }
              if(counter%5==0){
                 stringBuilder2.append(s).append("\n");
                 counter=0;
              }else
                  stringBuilder2.append(s).append(' ');
          }
          is2.close();
          }catch(Exception e){
              e.printStackTrace();
          }
  
          return stringBuilder2.toString(); //Here stringBuilder2 is null
  }
  </code></pre>