title: C# equivalent to Java's Float.floatToIntBits
body: <p>I've been writing a port of a networking library from Java and this is the last line of code I have yet to decipher and move on over. The line of code is as follows:</p>
  
  <pre><code>Float.floatToIntBits(Float);
  </code></pre>
  
  <p>Which returns an integer.</p>
  
  <p>The code of <strong>floatToIntBits</strong> in Java</p>
  
  <pre><code>public static int floatToIntBits(float value) {
          int result = floatToRawIntBits(value);
          // Check for NaN based on values of bit fields, maximum
          // exponent and nonzero significand.
          if ( ((result &amp; FloatConsts.EXP_BIT_MASK) ==
                FloatConsts.EXP_BIT_MASK) &amp;&amp;
               (result &amp; FloatConsts.SIGNIF_BIT_MASK) != 0)
              result = 0x7fc00000;
          return result;
      }
  </code></pre>
  
  <p>I'm not nearly experienced enough with memory and hex values to port this over myself, not to mention the bit shifting that's all over the place that's been driving me absolutely mad.</p>