title: Java CRC32 calculation in a multi threading envirinment
body: <p>I have a following util class for crc32 calculation:</p>
  
  <pre><code>import java.util.zip.CRC32;
  import java.util.zip.Checksum;
  
  public class StringUtils {
  
      public static long crc32(String input) {
          byte[] bytes = input.getBytes();
          Checksum checksum = new CRC32();
          checksum.update(bytes, 0, bytes.length);
  
          return checksum.getValue();
      }
  
  }
  </code></pre>
  
  <p>Performance is a very important criterion for me.</p>
  
  <p>Right now I'm thinking on a possible refactoring of this method and I'm thinking to move <code>checksum</code> to a class level as a static field... something like this:</p>
  
  <pre><code>public class StringUtils {
  
      public static Checksum checksum = new CRC32();
  
      public static long crc32(String input) {
          byte[] bytes = input.getBytes();
          checksum.update(bytes, 0, bytes.length);
  
          return checksum.getValue();
      }
  
  }
  </code></pre>
  
  <p>but I'm not sure will it correctly work in a concurrent multithreading environment. Please advise - such kind of refactoring it's a good idea or not.</p>