title: What does & 0xff do And MD5 Structure?
body: <pre><code>import java.security.MessageDigest;
  import java.security.NoSuchAlgorithmException;
  
  public class JavaMD5 {
  
      public static void main(String[] args) {
          String passwordToHash = "MyPassword123";
          String generatedPassword = null;
          try {
              MessageDigest md = MessageDigest.getInstance("MD5");
              md.update(passwordToHash.getBytes());
              byte[] bytes = md.digest();
              StringBuilder sb = new StringBuilder();
              for (int i = 0; i &lt; bytes.length; i++) {
                  sb.append(Integer.toString((bytes[i] &amp; 0xff) + 0x100, 16).substring(1));
              }
              generatedPassword = sb.toString();
  
          } catch (NoSuchAlgorithmException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          System.out.println(generatedPassword);
      }
  }
  </code></pre>
  
  <p>This line is the problem : </p>
  
  <pre><code>sb.append(Integer.toString((bytes[i] &amp; 0xff) + 0x100, 16).substring(1));
  </code></pre>
  
  <p>what does each part do in  this structure????</p>
  
  <p>Thanks and I'm sorry for asking Beacuse I'm new in java.</p>