{"id":853,"date":"2021-09-16T09:58:00","date_gmt":"2021-09-16T01:58:00","guid":{"rendered":"http:\/\/www.langmanezhuang.com\/index.php\/2021\/09\/16\/java%e5%ae%9e%e7%8e%b0float32-%e7%b1%bb%e5%9e%8b%e8%bd%ac%e6%8d%a2%e5%a4%a7%e5%b0%8f%e7%ab%af%e8%bd%ac%e6%8d%a2%ef%bc%8c%e4%bb%8e%ef%bc%881234%ef%bc%89%e5%88%b0-3412-%e4%ba%a4%e6%8d%a2%e5%ad%97\/"},"modified":"2021-09-16T09:58:00","modified_gmt":"2021-09-16T01:58:00","slug":"java%e5%ae%9e%e7%8e%b0float32-%e7%b1%bb%e5%9e%8b%e8%bd%ac%e6%8d%a2%e5%a4%a7%e5%b0%8f%e7%ab%af%e8%bd%ac%e6%8d%a2%ef%bc%8c%e4%bb%8e%ef%bc%881234%ef%bc%89%e5%88%b0-3412-%e4%ba%a4%e6%8d%a2%e5%ad%97","status":"publish","type":"post","link":"http:\/\/blog.langmanezhuang.com\/index.php\/2021\/09\/16\/java%e5%ae%9e%e7%8e%b0float32-%e7%b1%bb%e5%9e%8b%e8%bd%ac%e6%8d%a2%e5%a4%a7%e5%b0%8f%e7%ab%af%e8%bd%ac%e6%8d%a2%ef%bc%8c%e4%bb%8e%ef%bc%881234%ef%bc%89%e5%88%b0-3412-%e4%ba%a4%e6%8d%a2%e5%ad%97\/","title":{"rendered":"JAVA\u5b9e\u73b0FLOAT32 \u7c7b\u578b\u8f6c\u6362\u5927\u5c0f\u7aef\u8f6c\u6362\uff0c\u4ece\uff081234\uff09\u5230 (3412) \u4ea4\u6362\u5b57\u8282\u6a21\u5f0f"},"content":{"rendered":"<p>\u793a\u4f8b3\uff0c\u5f53\u5199\u5165287454020\u65f6\uff0c\u5bf9\u5e94\u7684\u5341\u516d\u8fdb\u5236\u4e3a0x11223344, \u7ecf\u8fc7\u4f7f\u7528\u4e0d\u540c\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u5b57\u8282\u5e8f\u540e\uff0c\u53d1\u9001\u548c\u63a5\u6536\u987a\u5e8f\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<ul class=\"list\">\n<ul class=\"list\">\n<li value=\"1\">FLOAT32 (3412) \u5c0f\u7aef\u4ea4\u6362\u5b57\u8282\u6a21\u5f0f 33,44,11,22<\/li>\n<li value=\"2\">FLOAT32 (1234) \u5927\u7aef\u6a21\u5f0f 11,22,33,44<\/li>\n<li value=\"3\">FLOAT32(2143) \u5927\u7aef\u4ea4\u6362\u5b57\u8282\u6a21\u5f0f 22,11,44,33<\/li>\n<li value=\"4\">FLOAT32(4321) \u5c0f\u7aef\u6a21\u5f0f 44,33,22,11<\/li>\n<\/ul>\n<\/ul>\n<p>1.\u5b9e\u73b0\u3010FLOAT32 (3412) \u5c0f\u7aef\u4ea4\u6362\u5b57\u8282\u6a21\u5f0f 33,44,11,22\u3011\u8fd9\u79cd\u6a21\u5f0f<\/p>\n<p>\u5b9e\u73b0\u601d\u8def<\/p>\n<p>&nbsp;<\/p>\n<div class=\"cnblogs_Highlighter\">\n<pre class=\"brush:bash;gutter:true;\">1 2 3 4  init\n\n\nb[0] = (byte) (fbit &gt;&gt; 16)\nb[1] = (byte) (fbit) \n\nb[0]= 0 0 1 2\nb[1]= 1 2 3 4\n\n\nl = b[0]\n0 0 1 2\n\nl &amp;= 0xffff\n0 0 1 2\n\n\n\nl |= ((long) b[2] &lt;&lt; 16)\n3 4 0 0\n0 0 1 2\n-------|\n3 4 1 3\n<\/pre>\n<\/div>\n<p>\u3000\u3000<\/p>\n<p>&nbsp;Java\u5b9e\u73b0\u4ee3\u7801\uff1a<\/p>\n<div class=\"cnblogs_Highlighter\">\n<pre class=\"brush:java;gutter:true;\">\/\/\u65b9\u6cd51\uff1a  <br \/>\/\/(3412) \u5c0f\u7aef\u4ea4\u6362\u5b57\u8282\u6a21\u5f0f\n    private float big2Little(float big){\n        \/\/ \u628afloat\u8f6c\u6362\u4e3abyte[]\n        int fbit = Float.floatToIntBits(big);\n\n        byte[] b = new byte[4];\n        b[0] = (byte) (fbit &gt;&gt; 16);\n        b[1] = (byte) (fbit);\n        \n        int l;\n        l = b[0];\n        l &amp;= 0xff;\n        l |= ((long) b[2] &lt;&lt; 16);\n        float little = Float.intBitsToFloat(l);\n        return little;\n    }<br \/><br \/>\n<\/pre>\n<\/div>\n<div class=\"cnblogs_Highlighter\">\n<pre class=\"brush:java;gutter:true;\">\/\/\u65b9\u6cd52\uff1a    \nprivate float big2Little(float big){\n        \n    \t\/\/ \u628afloat\u8f6c\u6362\u4e3abyte[]\n    \tint fbit = Float.floatToIntBits(big);\n\n    \tint a = fbit &lt;&lt; 16;\n    \ta &amp;= 0xFFFF0000;\n    \tSystem.out.println(\"a:\"+ a);\n\n        int b = fbit &gt;&gt; 16;\n    \tb &amp;= 0xFFFF;\n        System.out.println(\"b:\"+ b);\n        \n        int l;\n        l = a|b;\n        \n        System.out.println(\"l:\"+l);\n        \n        float little = Float.intBitsToFloat(l);\n        return little;\n    }\n<\/pre>\n<\/div>\n<p>\u3000\u3000<\/p>\n<p>\u6ce8\u610f\uff1al &amp;= 0xff;&nbsp; \u5b9e\u73b0\u7684\u529f\u80fd\u4e3a\u9ad8\u4f4d\u6e050&nbsp; \u56e0\u4e3a\u3010\u6c47\u7f16\u8bed\u8a00\u4e2d\u7684\u903b\u8f91\u53f3\u79fb(SHR)\u662f\u5c06\u5404\u4f4d\u4f9d\u6b21\u53f3\u79fb\u6307\u5b9a\u4f4d\u6570\uff0c\u7136\u540e\u5728\u5de6\u4fa7\u88650\uff0c\u7b97\u672f\u53f3\u79fb(SAR)\u662f\u5c06\u5404\u4f4d\u4f9d\u6b21\u53f3\u79fb\u6307\u5b9a\u4f4d\u6570\uff0c\u7136\u540e\u5728\u5de6\u4fa7\u7528\u539f\u7b26\u53f7\u4f4d\u8865\u9f50\u3011<\/p>\n<p>\u53c2\u7167&nbsp; :<a href=\"https:\/\/www.cnblogs.com\/huangjianwu\/p\/4549085.html\" target=\"_blank\" rel=\"noopener\">\u79fb\u4f4d\u64cd\u4f5c\u548c\u4e8c\u8fdb\u5236\u77e5\u8bc6<\/a><\/p>\n<p>&nbsp;2.\u5b9e\u73b0\u3010FLOAT32(4321) \u5c0f\u7aef\u6a21\u5f0f 44,33,22,11\u3011\u8fd9\u79cd\u6a21\u5f0f<\/p>\n<p>&nbsp;\u5b9e\u73b0\u601d\u8def\uff1a<\/p>\n<div class=\"cnblogs_Highlighter\">\n<pre class=\"brush:bash;gutter:true;\">1 2 3 4  init\n\n\nb[0]= 0 0 0 1\nb[1]= 0 0 1 2\nb[2]= 0 1 2 3\nb[3]= 1 2 3 4\n\nl = b[0]\n0 0 0 1\nl &amp;= 0xff\n0 0 0 1\n\nl |= ((long) b[1] &lt;&lt; 8)\n0 1 2 0\n0 0 0 1\n-------|\n0 1 2 1\n\nl &amp;= 0xffff\n0 0 2 1\n\nl |= ((long) b[2] &lt;&lt; 16)\n#1 2 3 0 0\n2 3 0 0\n0 0 2 1\n-------|\n2 3 2 1\n\nl &amp;= 0xffffff  \n0 3 2 1\n\nl |= ((long) b[3] &lt;&lt; 24)\n4 0 0 0\n0 3 2 1\n-------|\n4 3 2 1\n<\/pre>\n<\/div>\n<p>\u3000<\/p>\n<p>&nbsp;&nbsp;Java\u5b9e\u73b0\u4ee3\u7801\uff1a<\/p>\n<p>&nbsp;<\/p>\n<div class=\"cnblogs_Highlighter\">\n<pre class=\"brush:java;gutter:true;\">\/\/\u5927\u7aef\uff081234\uff09\u8f6c\u5c0f\u7aef\uff084321\uff09\nprivate float big2Little(float big){\n    \/\/ \u628afloat\u8f6c\u6362\u4e3abyte[]\n    int fbit = Float.floatToIntBits(big);\n\n    byte[] b = new byte[4];\n    b[0] = (byte) (fbit &gt;&gt; 24);\n    b[1] = (byte) (fbit &gt;&gt; 16);\n    b[2] = (byte) (fbit &gt;&gt; 8);\n    b[3] = (byte) (fbit);\n    \n    int l;\n    l = b[0];\n    l &amp;= 0xff;\n    l |= ((long) b[1] &lt;&lt; 8);\n    l &amp;= 0xffff;\n    l |= ((long) b[2] &lt;&lt; 16);\n    l &amp;= 0xffffff;\n    l |= ((long) b[3] &lt;&lt; 24);\n    float little = Float.intBitsToFloat(l);\n    return little;\n}<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>\u4e8c\u8fdb\u5236\u8d70\u8bfb\u6267\u884c\uff1a<\/p>\n<div class=\"cnblogs_Highlighter\">\n<pre class=\"brush:bash;gutter:true;\">FLOAT32 (3412)\n\n80 00 44 2c       \uff081234\uff09\u7aef  \n\n2c 44 00 80       \uff084321\uff09\u7aef\n\n\u5927\u7aef\u8f6c\u5c0f\u7aef\u8fc7\u7a0b\n\n1000 0000 0000 0000 0100 0100 0010 1100  init\n\nb[0]=init&gt;&gt;24\n0000 0000 0000 0000 0000 0000 1000 0000\n\nb[1]=init&gt;&gt;16\n0000 0000 0000 0000 1000 0000 0000 0000\n\nb[2]=init&gt;&gt;8\n0000 0000 1000 0000 0000 0000 0100 0100\n\nb[3]=init\n1000 0000 0000 0000 0100 0100 0010 1100\n\nl = b[0]\n0000 0000 0000 0000 0000 0000 1000 0000\n\nl &amp;= 0xff\n0000 0000 0000 0000 0000 0000 1000 0000\n0000 0000 0000 0000 0000 0000 1111 1111\n----------------------------------------&amp;\n0000 0000 0000 0000 0000 0000 1000 0000\n\nl |= ((long) b[1] &lt;&lt; 8)\n\n0000 0000 1000 0000 0000 0000 0000 0000\n0000 0000 0000 0000 0000 0000 1000 0000\n----------------------------------------|\n0000 0000 1000 0000 0000 0000 1000 0000\n\nl &amp;= 0xffff\n\n0000 0000 1000 0000 0000 0000 1000 0000\n0000 0000 0000 0000 1111 1111 1111 1111\n----------------------------------------&amp;\n0000 0000 0000 0000 0000 0000 1000 0000\n\nl |= ((long) b[2] &lt;&lt; 16)\n\n0000 0000 0100 0100 0000 0000 0000 0000\n0000 0000 0000 0000 0000 0000 1000 0000\n----------------------------------------|\n0000 0000 0100 0100 0000 0000 1000 0000\n\nl &amp;= 0xffffff\n\n0000 0000 0100 0100 0000 0000 1000 0000\n0000 0000 1111 1111 1111 1111 1111 1111\n---------------------------------------&amp;\n0000 0000 0100 0100 0000 0000 1000 0000\n\nl |= ((long) b[3] &lt;&lt; 24)\n0010 1100 0000 0000 0000 0000 0000 0000\n0000 0000 0100 0100 0000 0000 1000 0000\n-----------------------------------------|\n0010 1100 0100 0100 0000 0000 1000 0000\n2    c    4     4   0    0   8    0\n\n\n1000 0000 0000 0000 0100 0100 0010 1100\n<\/pre>\n<\/div>\n<p>\u3000\u3000<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u793a\u4f8b3\uff0c\u5f53\u5199\u5165287454020\u65f6\uff0c\u5bf9\u5e94\u7684\u5341\u516d\u8fdb\u5236\u4e3a0x11223344, \u7ecf\u8fc7\u4f7f\u7528\u4e0d\u540c\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u5b57\u8282\u5e8f\u540e\uff0c &hellip; <a href=\"http:\/\/blog.langmanezhuang.com\/index.php\/2021\/09\/16\/java%e5%ae%9e%e7%8e%b0float32-%e7%b1%bb%e5%9e%8b%e8%bd%ac%e6%8d%a2%e5%a4%a7%e5%b0%8f%e7%ab%af%e8%bd%ac%e6%8d%a2%ef%bc%8c%e4%bb%8e%ef%bc%881234%ef%bc%89%e5%88%b0-3412-%e4%ba%a4%e6%8d%a2%e5%ad%97\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">JAVA\u5b9e\u73b0FLOAT32 \u7c7b\u578b\u8f6c\u6362\u5927\u5c0f\u7aef\u8f6c\u6362\uff0c\u4ece\uff081234\uff09\u5230 (3412) \u4ea4\u6362\u5b57\u8282\u6a21\u5f0f<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/853"}],"collection":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/comments?post=853"}],"version-history":[{"count":0,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/853\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/media?parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/categories?post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/tags?post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}