title: Read hex file in java and traduce it into ascii
body: <p>Good Morning i have a serius problem. 
  I need to read a file in hex ​​and translate it into ascii. 
  I also need to write the ascii on another file.
  I tried so:</p>
  
  <pre><code>/**
   * @param args the command line arguments
   */
  public static void main(String[] args) throws FileNotFoundException, IOException {
      FileInputStream in = new FileInputStream("fileAscii");
      int read;
      String hex = "";
      int count = 0;
      String valueRead="";
      PrintWriter writer= new PrintWriter("fileOutput");
  
      while ((read = in.read()) != -1) {
          count++;
          valueRead= Integer.toHexString(read);
          if(valueRead.length()==1){
              hex=hex+"0";
          }
          hex = hex + valueRead;
          if (is16Multipler(count)) {
  
              System.out.println(hex);
              String sb = "";
              StringBuilder temp = new StringBuilder();
              for (int i = 0; i &lt; hex.length() - 1; i += 2) {
  
                  //grab the hex in pairs
                  String output = hex.substring(i, (i + 2));
                  //convert hex to decimal
                  int decimal = Integer.parseInt(output, 16);
                  //convert the decimal to character
                  sb=sb+(char) decimal;
  
  
              }
              if(!sb.equals("00000000000000000000000000000000"))
              {
                 writer.println(sb.toString());
              }
  
  
                 hex = "";
          }
      }
  }
  
  
  public static boolean is16Multipler(int number) {
      if (number % 16 == 0) {
          return true;
      }
      return false;
  }
  </code></pre>
  
  <p>the problem is that I read the wrong values ​​for example read 83  bat the original file contains 84</p>