{"id":1085,"date":"2010-03-18T09:50:00","date_gmt":"2010-03-18T01:50:00","guid":{"rendered":"\/?p=1085"},"modified":"2010-03-18T09:50:00","modified_gmt":"2010-03-18T09:50:00","slug":"1085","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/php\/1085.html","title":{"rendered":"\u5229\u7528"\u4e8c\u8fdb\u5236"\u6765\u63a7\u5236\u6743\u9650"},"content":{"rendered":"

\u4e00\u3001\u5229\u7528\u4f4d\u4e0e
1.\u4ecb\u7ecd\uff1a<\/strong>
\u8fd9\u91cc\u6211\u4ecb\u7ecd\u4e00\u79cd\u5f88\u5e38\u7528\uff0c\u4e5f\u6bd4\u8f83Professor\u7684\u6743\u9650\u63a7\u5236\u601d\u8def\u3002
\u8fd9\u91cc\u6211\u7528java\u8bed\u8a00\u63cf\u8ff0\uff0c\u5176\u5b9e\u90fd\u5dee\u4e0d\u591a\u7684\u3002\u81ea\u5df1\u8f6c\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\u3002
\u4e3a\u4e86\u65b9\u4fbf\uff0c\u6211\u4eec\u8fd9\u91cc\u5b9a\u4e49a^b\u4e3a\uff1aa\u7684b\u6b21\u65b9
\u8fd9\u91cc\uff0c\u6211\u4eec\u4e3a\u6bcf\u4e00\u4e2a\u64cd\u4f5c\u8bbe\u5b9a\u4e00\u4e2a\u552f\u4e00\u7684\u6574\u6570\u503c\uff0c\u6bd4\u5982\uff1a<\/p>\n

\u5220\u9664\uff21\uff0d\uff0d\uff0d0
\u4fee\u6539\uff21\uff0d\uff0d\uff0d1
\u6dfb\u52a0\uff21\uff0d\uff0d\uff0d2<\/p>\n

\u5220\u9664\uff22\uff0d\uff0d\uff0d3
\u4fee\u6539\uff22\uff0d\uff0d\uff0d4
\u6dfb\u52a0\uff22\uff0d\uff0d\uff0d5
\u3002\u3002\u3002<\/p>\n

\u7406\u8bba\u4e0a\u53ef\u4ee5\u6709\uff2e\u4e2a\u64cd\u4f5c
\u8fd9\u53d6\u51b3\u4e8e\u4f60\u7528\u4e8e\u50a8\u5b58\u7528\u6237\u6743\u9650\u503c\u7684\u6570\u636e\u7c7b\u578b\u4e86\u3002<\/p>\n

\u8fd9\u6837\uff0c\u5982\u679c\u7528\u6237\u6709\u6743\u9650\uff1a\u6dfb\u52a0\uff21\uff0d\uff0d\uff0d2\uff1b\u5220\u9664\uff22\uff0d\uff0d\uff0d3\uff1b\u4fee\u6539\uff22\uff0d\uff0d\uff0d4
\u90a3\u7528\u6237\u7684\u6743\u9650\u503c purview =2^2+2^3+2^4\uff1d28\uff0c\u4e5f\u5c31\u662f2\u7684\u6743\u7684\u548c\u4e86\uff08\u4e4b\u524d\u6253\u9519\u4e86\uff09\u3002
\u5316\u6210\u4e8c\u8fdb\u5236\u53ef\u4ee5\u8868\u793a\u4e3a11100
\u8fd9\u6837\uff0c\u5982\u679c\u8981\u9a8c\u8bc1\u7528\u6237\u662f\u5426\u6709\u5220\u9664\uff22\u7684\u6743\u9650\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u4f4d\u4e0e\u8fd0\u7b97\u6765\u5b9e\u73b0\u3002
\u5728\uff2a\uff41\uff56\uff41\u91cc\uff0c\u4f4d\u4e0e\u8fd0\u7b97\u8fd0\u7b97\u7b26\u53f7\u4e3a\uff06
\u5373\u662f\uff1aint value = purview &((int)Math.pow(2,3));
\u4f60\u4f1a\u53d1\u73b0\uff0c\u5f53\u7528\u6237\u6709\u64cd\u4f5c\u6743\u9650\u65f6\uff0c\u8fd0\u7b97\u51fa\u6765\u7684\u7ed3\u679c\u90fd\u4f1a\u7b49\u4e8e\u8fd9\u4e2a\u64cd\u4f5c\u9700\u8981\u7684\u6743\u9650\u503c\uff01
\u539f\u7406\uff1a
\u4f4d\u4e0e\u8fd0\u7b97\uff0c\u987e\u540d\u601d\u4e49\u5c31\u662f\u5bf9\u4f4d\u8fdb\u884c\u4e0e\u8fd0\u7b97\uff1a
\u4ee5\u4e0a\u9762\u7684\u5f0f\u5b50\u4e3a\u4f8b\uff1apurview & 2^3 \u4e5f\u5c31\u662f\u300028&8
\u5c06\u5b83\u4eec\u5316\u6210\u4e8c\u8fdb\u5236\u6709
   11100
\uff06  01000
——————-
   01000 == 8(\u5341\u8fdb\u5236)\u3000\uff1d\uff1d\u30002^3
\u540c\u7406\uff0c\u5982\u679c\u8981\u9a8c\u8bc1\u662f\u5426\u6709\u5220\u9664\uff21\uff0d\uff0d\uff0d0\u7684\u6743\u9650
\u53ef\u4ee5\u7528\uff1apurview &((int)Math.pow(2,0));
\u5373\uff1a
   11100
  \uff06 00001
————————
    00000 ==  0(\u5341\u8fdb\u5236)\u3000\u3000\uff01\uff1d\u30002^0<\/p>\n

\u8fd9\u79cd\u7b97\u6cd5\u7684\u4e00\u4e2a\u4f18\u70b9\u662f\u901f\u5ea6\u5feb\u3002\u53ef\u4ee5\u540c\u65f6\u5904\u7406\uff2e\u4e2a\u6743\u9650
\u5982\u679c\u60f3\u9a8c\u8bc1\u662f\u5426\u540c\u65f6\u6709\u5220\u9664\uff21\uff0d\uff0d\uff0d0\u548c\u5220\u9664\uff22\uff0d\uff0d\uff0d3\u7684\u6743\u9650
\u53ef\u4ee5\u7528purview&(2^0+2^3)==(2^0+2^3)?true:false;
\u8bbe\u7f6e\u591a\u89d2\u8272\u7528\u6237\u3002\u6839\u636e\u6743\u9650\u503c\u5224\u65ad\u7528\u6237\u7684\u89d2\u8272\u3002\u3002\u3002<\/p>\n

\u4e0b\u9762\u63d0\u4f9b\u4e00\u4e2ajava\u7684\u5355\u64cd\u4f5c\u6743\u9650\u5224\u65ad\u7684\u4ee3\u7801\uff1a
\/\/userPurview\u662f\u7528\u6237\u5177\u6709\u7684\u603b\u6743\u9650
\/\/optPurview\u662f\u4e00\u4e2a\u64cd\u4f5c\u8981\u6c42\u7684\u6743\u9650\u4e3a\u4e00\u4e2a\u6574\u6570\uff08\u6ca1\u6709\u7ecf\u8fc7\u6743\u7684\uff01\uff09
public static boolean checkPower(int userPurview, int optPurview)
{
      int purviewValue = (int)Math.pow(2, optPurview);
      return (userPurview & purviewValue) == purviewValue;
}<\/p>\n

\u5f53\u7136\uff0c\u591a\u6743\u9650\u7684\u9a8c\u8bc1\u53ea\u8981\u6269\u5c55\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n

2.\u539f\u7406\uff1a<\/strong>
\u5176\u5b9e
\u6dfb\u52a0\uff21\uff0d\uff0d\uff0d2\u3000\u30002^2 ==  4 ==  00100
\u5220\u9664\uff22\uff0d\uff0d\uff0d3\u3000\u30002^3 ==  8 ==  01000
\u4fee\u6539\uff22\uff0d\uff0d\uff0d4\u3000\u30002^4 ==  16 ==  10000
\u4e09\u4e2a\u503c\u76f8\u52a0\u5c31\u662f11100B == 28(D)\u4e86<\/p>\n

\u4e5f\u5c31\u662f\u8bf4\uff0c\u8ba9\u6bcf\u4e00\u4e2a\u64cd\u4f5c\u6743\u9650\u503c\u90fd\u662f\u53ea\u6709\u4e00\u4e2a1\u548c\uff2e\u4e2a\u96f6\u7ec4\u6210\u7684\u552f\u4e00\u6392\u5217
\u8fd9\u6837\uff0c\u51e0\u4e2a\u6743\u9650\u76f8\u52a0\u65f6\u5c31\u4e0d\u4f1a\u51fa\u73b0\u8fdb\u4f4d\u7684\u95ee\u9898\u4e86\u3002\u4fdd\u8bc1\u4e86\u6bcf\u4e2a\u64cd\u4f5c\u6743\u9650\u90fd\u662f\u72ec\u7acb\u7684\u3002
\u6743\u9650\u503c\u53ea\u662f\u4e00\u4e2a\u4ee3\u53f7\uff0c\u4e0e\u5927\u5c0f\u65e0\u5173\u3002<\/p>\n

3.\u6ce8\u610f\uff1a
<\/strong>(1)\u4e00\u4e2a\u7cfb\u7edf\u53ef\u80fd\u6709\u5f88\u591a\u7684\u64cd\u4f5c\uff0c\u56e0\u6b64\uff0c\u8bf7\u5efa\u7acb\u6570\u636e\u5b57\u5178\uff0c\u4ee5\u4fbf\u67e5\u9605\uff0c\u4fee\u6539\u65f6\u4f7f\u7528\u3002
(2)\u5982\u679c\u7528\u6570\u636e\u5e93\u50a8\u5b58\u7528\u6237\u6743\u9650\uff0c\u8bf7\u6ce8\u610f\u6570\u503c\u7684\u6709\u6548\u8303\u56f4\u3002\u64cd\u4f5c\u6743\u9650\u503c\u8bf7\u7528\u552f\u4e00\u7684\u6574\u6570\uff01
(3)java\u91cc\u4e00\u4e2aint\u662f2^32\u5927\u5c0f\uff0c\u6240\u4ee5\u4e0d\u4f1a\u5c06\u6743\u9650\u90fd\u5206\u5728\u4e00\u4e2a\u7ec4\u91cc\uff0c\u90fd\u4f1a\u5206\u6210\u51e0\u4e2a\u6a21\u5757\uff0c\u5bf9\u4e00\u4e2a\u6a21\u5757\u7528int\u7c7b\u578b\u670931\u4e2a\u6743\u9650\u5206\u914d\uff0c\u4e00\u822c\u90fd\u53ef\u4ee5\u6ee1\u8db3\u4e86\u3002\u5efa\u8bae\u5206\u7ec4\u6216\u7528\u5927\u4e00\u70b9\u7684long\u578b\u3002<\/p>\n

\u4e8c\u3001\u76f4\u63a5\u75281010……..\u8868\u793a<\/strong>
\u76f4\u63a5\u7528\u5b57\u7b26\u4e32:010101111010011010000………
\u5224\u65ad\uff1a0\u5c31\u662f\u6ca1\u6743\u9650\uff0c1\u5c31\u662f\u6709\u6743\u9650\u3002<\/p>\n

\u539f\u6587\uff1a<\/strong>http:\/\/huangy82.blog.163.com\/blog\/static\/490698272009102310216497\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e00\u3001\u5229\u7528\u4f4d\u4e0e
1.\u4ecb\u7ecd\uff1a<\/strong>
\u8fd9\u91cc\u6211\u4ecb\u7ecd\u4e00\u79cd\u5f88\u5e38\u7528\uff0c\u4e5f\u6bd4\u8f83Professor\u7684\u6743\u9650\u63a7\u5236\u601d\u8def\u3002
\u8fd9\u91cc\u6211\u7528java\u8bed\u8a00\u63cf\u8ff0\uff0c\u5176\u5b9e\u90fd\u5dee\u4e0d\u591a\u7684\u3002\u81ea\u5df1\u8f6c\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\u3002
\u4e3a\u4e86\u65b9\u4fbf\uff0c\u6211\u4eec\u8fd9\u91cc\u5b9a\u4e49a^b\u4e3a\uff1aa\u7684b\u6b21\u65b9
\u8fd9\u91cc\uff0c\u6211\u4eec\u4e3a\u6bcf\u4e00\u4e2a\u64cd\u4f5c\u8bbe\u5b9a\u4e00\u4e2a\u552f\u4e00\u7684\u6574\u6570\u503c\uff0c\u6bd4\u5982\uff1a<\/p>\n

\u5220\u9664\uff21\uff0d\uff0d\uff0d0
\u4fee\u6539\uff21\uff0d\uff0d\uff0d1
\u6dfb\u52a0\uff21\uff0d\uff0d\uff0d2<\/p>\n

\u5220\u9664\uff22\uff0d\uff0d\uff0d3
\u4fee\u6539\uff22\uff0d\uff0d\uff0d4
\u6dfb\u52a0\uff22\uff0d\uff0d\uff0d5
\u3002\u3002\u3002<\/p>\n

\u7406\u8bba\u4e0a\u53ef\u4ee5\u6709\uff2e\u4e2a\u64cd\u4f5c
\u8fd9\u53d6\u51b3\u4e8e\u4f60\u7528\u4e8e\u50a8\u5b58\u7528\u6237\u6743\u9650\u503c\u7684\u6570\u636e\u7c7b\u578b\u4e86\u3002<\/p>\n

\u8fd9\u6837\uff0c\u5982\u679c\u7528\u6237\u6709\u6743\u9650\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1085"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1085"}],"version-history":[{"count":0,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1085\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}