{"id":225901,"date":"2014-06-10T21:59:02","date_gmt":"2014-06-10T17:59:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=225901"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=225901","title":{"rendered":"<span class=\"post_title\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0432 Java<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432 Java \u043d\u0435\u0442 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432. \u0415\u0441\u043b\u0438 \u0432 \u0421\u0438 \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>unsigned int<\/code> (<code>char<\/code>, <code>long<\/code>), \u0442\u043e \u0432 Java \u0442\u0430\u043a \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u0440\u0435\u0434\u043a\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435-\u0442\u043e \u0438 \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043d\u0443\u0436\u043d\u044b (\u043f\u043e\u0434\u0443\u043c\u0430\u0435\u0448\u044c, <code>MaxInt<\/code> \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u044b \u0447\u0438\u0441\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0443 <code>long<\/code> \u0438 \u0434\u0430\u043b\u0435\u0435 <code>BigInteger<\/code>). \u041d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0432 \u0442\u043e\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0435\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 signed \u0438\u043b\u0438 unsigned int, \u0430 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0434 \u043d\u0438\u043c\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c\u0438 \u0438\u043b\u0438 \u0441 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u043e\u0439, \u0433\u0434\u0435 \u0432\u0430\u0436\u0435\u043d \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0431\u0438\u0442, \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<h4>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 byte \u0432 short (int, long)<\/h4>\n<p>  \u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u0430\u0441\u0442 <code>(int) myByte<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043e 32 \u0431\u0438\u0442 \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u2014 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442 \u0431\u0430\u0439\u0442\u0430 \u0431\u044b\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 1, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 32-\u0431\u0438\u0442\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<p>  <code>0xff -&gt; 0xffffffff (-1)<\/code><\/p>\n<p>  \u0427\u0430\u0441\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e, \u0447\u0435\u0433\u043e \u0431\u044b \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043e 32 \u0431\u0438\u0442 \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <code>0x000000ff<\/code>, \u0432 Java \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code class=\"java\">int myInt = myByte & 0xff; short myShort = myByte & 0xff; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u0437\u043d\u0430\u043a\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430:<\/p>\n<pre><code class=\"java\">int compareUnsigned(int a, int b) {     return Integer.compare( a ^ 0x80000000, b ^ 0x80000000 ); } <\/code><\/pre>\n<p>  \u0414\u043b\u044f byte, short \u0438 long, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0431\u0443\u0434\u0443\u0442 <code>0x80<\/code>, <code>0x8000<\/code> \u0438 <code>0x8000000000000000L<\/code>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0410 \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0441\u044e\u0440\u043f\u0440\u0438\u0437 \u2014 \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u041d\u043e \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u0441 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043b\u044e\u0431\u044b\u0435 \u043d\u0435\u044f\u0432\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u043a\u0430, \u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445. \u041a\u043e\u0432\u0430\u0440\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0438\u0445 \u0431\u0430\u0433\u043e\u0432 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0434\u043a\u043e.<\/p>\n<h4>\u0414\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0414\u0435\u043b\u0435\u043d\u0438\u0435 -256 \u043d\u0430 256 \u0434\u0430\u0441\u0442 \u043d\u0430\u043c -1. \u0410 \u043d\u0430\u043c \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u0431\u044b <code>0xffffff00 \/ 0x100<\/code> \u0434\u0430\u0432\u0430\u043b\u043e <code>0x00ffffff<\/code>, \u0430 \u043d\u0435 <code>0xffffffff (-1)<\/code>. \u0414\u043b\u044f <code>byte<\/code>, <code>short<\/code> \u0438 <code>int<\/code> \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u0447\u0438\u0441\u043b\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"java\">int a = 0xffffff00; int b = 0x100; int c = (int) ((a & 0xffffffffL) \/ b); \/\/ convert a to long before division <\/code><\/pre>\n<p>  \u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 <code>long<\/code>? \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 <code>BigInteger<\/code> \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u0432 \u0441\u0432\u043e\u0438 \u0440\u0443\u043a\u0438 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0432\u0441\u0451 \u0443\u0436\u0435 \u0443\u043a\u0440\u0430\u0434\u0435\u043d\u043e \u0434\u043e \u043d\u0430\u0441 \u2014 \u0432 <a href=\"https:\/\/code.google.com\/p\/guava-libraries\/\">Google Guava<\/a> \u0435\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f <code>long<\/code>, \u043f\u0440\u0438\u0447\u0451\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0448\u0443\u0441\u0442\u0440\u0430\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u044d\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0434\u0440\u0430\u0442\u044c \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 <a href=\"https:\/\/code.google.com\/p\/guava-libraries\/source\/browse\/guava\/src\/com\/google\/common\/primitives\/UnsignedLongs.java\">UnsignedLongs.java<\/a>:<\/p>\n<pre><code class=\"java\">  \/**    * Returns dividend \/ divisor, where the dividend and divisor are treated as unsigned 64-bit    * quantities.    *    * @param dividend the dividend (numerator)    * @param divisor the divisor (denominator)    * @throws ArithmeticException if divisor is 0    *\/   public static long divide(long dividend, long divisor) {     if (divisor &lt; 0) { \/\/ i.e., divisor &gt;= 2^63:       if (compare(dividend, divisor) &lt; 0) {         return 0; \/\/ dividend &lt; divisor       } else {         return 1; \/\/ dividend &gt;= divisor       }     }      \/\/ Optimization - use signed division if dividend &lt; 2^63     if (dividend &gt;= 0) {       return dividend \/ divisor;     }      \/*      * Otherwise, approximate the quotient, check, and correct if necessary. Our approximation is      * guaranteed to be either exact or one less than the correct value. This follows from fact      * that floor(floor(x)\/i) == floor(x\/i) for any real x and integer i != 0. The proof is not      * quite trivial.      *\/     long quotient = ((dividend &gt;&gt;&gt; 1) \/ divisor) &lt;&lt; 1;     long rem = dividend - quotient * divisor;     return quotient + (compare(rem, divisor) &gt;= 0 ? 1 : 0);   } <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <code>compare(long, long)<\/code>:<\/p>\n<pre><code class=\"java\">  \/**    * Compares the two specified {@code long} values, treating them as unsigned values between    * {@code 0} and {@code 2^64 - 1} inclusive.    *    * @param a the first unsigned {@code long} to compare    * @param b the second unsigned {@code long} to compare    * @return a negative value if {@code a} is less than {@code b}; a positive value if {@code a} is    *         greater than {@code b}; or zero if they are equal    *\/   public static int compare(long a, long b) {     return Longs.compare(flip(a), flip(b));   }  <\/code><\/pre>\n<p>  \u0438 <code>Longs.compare(long, long)<\/code> + <code>flip(long)<\/code>:<\/p>\n<pre><code class=\"java\">  \/**    * A (self-inverse) bijection which converts the ordering on unsigned longs to the ordering on    * longs, that is, {@code a &lt;= b} as unsigned longs if and only if {@code flip(a) &lt;= flip(b)}    * as signed longs.    *\/   private static long flip(long a) {     return a ^ Long.MIN_VALUE;   }    \/**    * Compares the two specified {@code long} values. The sign of the value    * returned is the same as that of {@code ((Long) a).compareTo(b)}.    *    * @param a the first {@code long} to compare    * @param b the second {@code long} to compare    * @return a negative value if {@code a} is less than {@code b}; a positive    *     value if {@code a} is greater than {@code b}; or zero if they are equal    *\/   public static int compare(long a, long b) {     return (a &lt; b) ? -1 : ((a &gt; b) ? 1 : 0);   } <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u0441\u0434\u0432\u0438\u0433\u0438<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u043c\u0443 \u043e \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445, \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0442\u0430\u043a\u0436\u0435 \u043e \u0441\u0434\u0432\u0438\u0433\u0430\u0445. \u0412 x86 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435 \u0435\u0441\u0442\u044c \u0446\u0435\u043b\u0430\u044f \u043f\u0430\u0447\u043a\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u0441\u0434\u0432\u0438\u0433\u0438 \u2014 SHL, SHR, SAL, SAR, ROR, ROL, RCR, RCL. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 4 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0434\u0432\u0438\u0433\u0438, \u0438\u0445 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043e\u0432 \u0432 Java \u043d\u0435\u0442. \u0410 \u0432\u043e\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0434\u0432\u0438\u0433\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442. \u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 (\u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u043a\u0430) \u2014 SHL (shift left) \u0438 SHR (shift right) \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Java \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 <code>&lt;&lt;<\/code> \u0438 <code>&gt;&gt;&gt;<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0434\u0432\u0438\u0433\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0447\u0438\u0441\u043b\u0430 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438. \u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 (\u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u043a) \u0432\u043f\u0440\u0430\u0432\u043e \u2014 SAR \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c <code>&gt;&gt;<\/code>. \u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0434\u0432\u0438\u0433 \u0432\u043b\u0435\u0432\u043e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0435\u0442. \u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c, \u0447\u0442\u043e \u0432 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u043f\u043a\u043e\u0434 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0442\u043e \u0435\u0441\u0442\u044c SAL \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 SHL, \u0438 \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u0440\u044f\u043c\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043e\u0442 Intel:  <\/p>\n<blockquote><p>The shift arithmetic left (SAL) and shift logical left (SHL) instructions perform the same operation; they shift the bits in the destination operand to the left (toward more significant bit locations). For each shift count, the most significant bit of the destination operand is shifted into the CF flag, and the least significant bit is cleared (see Figure 7-7 in the Intel\u00ae64 and IA-32 Architectures Software Developer&#8217;sManual, Volume 1).<\/p><\/blockquote>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c SAL \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0438, \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u0434\u0432\u0438\u0433\u0430 \u0432\u043f\u0440\u0430\u0432\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439. \u041d\u0443 \u0430 \u0413\u043e\u0441\u043b\u0438\u043d\u0433 \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f (\u0438, \u0434\u0443\u043c\u0430\u0435\u0442\u0441\u044f, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043b).<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"java\">a &lt;&lt; 1; \/\/ \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0441\u0434\u0432\u0438\u0433 \u0432\u043b\u0435\u0432\u043e, \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044e \u043d\u0430 2 a &gt;&gt; 1; \/\/ \u0441\u0434\u0432\u0438\u0433 \u0432\u043f\u0440\u0430\u0432\u043e \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0437\u043d\u0430\u043a\u0430 (\u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044e \u043d\u0430 2) a &gt;&gt;&gt; 1; \/\/ \u0441\u0434\u0432\u0438\u0433 \u0432\u043f\u0440\u0430\u0432\u043e \u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u0437\u043d\u0430\u043a\u0430 (\u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u043c\u0443 \u0434\u0435\u043b\u0435\u043d\u0438\u044e \u043d\u0430 2) <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0435, \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f (assertions). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 32-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0445 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0432 32 \u0431\u0438\u0442\u0430, \u0438 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u0432 32 \u0431\u0438\u0442\u0430, \u043b\u0438\u0431\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0430 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430 \u0432 long (\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 <code>a & 0xffffffffL<\/code>). \u0417\u0434\u0435\u0441\u044c, \u043a\u0441\u0442\u0430\u0442\u0438, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432. \u041d\u0435\u0442, \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 long \u043e\u0431\u0430, \u0442.\u043a. \u0435\u0441\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u043d\u0434 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u0432 long \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u043a\u0430, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c. <\/li>\n<li> \u0429\u0435\u0434\u0440\u043e \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 Java \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439, \u0438 \u0447\u0430\u0441\u0442\u043e \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041b\u0443\u0447\u0448\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0441\u043a\u043e\u0431\u043e\u043a, \u0447\u0435\u043c \u043f\u043e\u0442\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0443\u043b\u043e\u0432\u0438\u043c\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0442\u0438\u043f\u0430 <code>long<\/code>, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <code>L<\/code> \u0432 \u043a\u043e\u043d\u0435\u0446 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 <code>long<\/code>, \u0430 <code>int<\/code>, \u0438 \u043f\u0440\u0438 \u043d\u0435\u044f\u0432\u043d\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043a <code>long<\/code> \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u043d\u0430\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c.<\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/225901\/\"> http:\/\/habrahabr.ru\/post\/225901\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432 Java \u043d\u0435\u0442 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432. \u0415\u0441\u043b\u0438 \u0432 \u0421\u0438 \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>unsigned int<\/code> (<code>char<\/code>, <code>long<\/code>), \u0442\u043e \u0432 Java \u0442\u0430\u043a \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u0440\u0435\u0434\u043a\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435-\u0442\u043e \u0438 \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043d\u0443\u0436\u043d\u044b (\u043f\u043e\u0434\u0443\u043c\u0430\u0435\u0448\u044c, <code>MaxInt<\/code> \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u044b \u0447\u0438\u0441\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0443 <code>long<\/code> \u0438 \u0434\u0430\u043b\u0435\u0435 <code>BigInteger<\/code>). \u041d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0432 \u0442\u043e\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0435\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 signed \u0438\u043b\u0438 unsigned int, \u0430 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0434 \u043d\u0438\u043c\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c\u0438 \u0438\u043b\u0438 \u0441 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u043e\u0439, \u0433\u0434\u0435 \u0432\u0430\u0436\u0435\u043d \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0431\u0438\u0442, \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<h4>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 byte \u0432 short (int, long)<\/h4>\n<p>  \u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u0430\u0441\u0442 <code>(int) myByte<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043e 32 \u0431\u0438\u0442 \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u2014 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442 \u0431\u0430\u0439\u0442\u0430 \u0431\u044b\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 1, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 32-\u0431\u0438\u0442\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<p>  <code>0xff -&gt; 0xffffffff (-1)<\/code><\/p>\n<p>  \u0427\u0430\u0441\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e, \u0447\u0435\u0433\u043e \u0431\u044b \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043e 32 \u0431\u0438\u0442 \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <code>0x000000ff<\/code>, \u0432 Java \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code class=\"java\">int myInt = myByte &#038; 0xff; short myShort = myByte &#038; 0xff; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u0437\u043d\u0430\u043a\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430:<\/p>\n<pre><code class=\"java\">int compareUnsigned(int a, int b) {     return Integer.compare( a ^ 0x80000000, b ^ 0x80000000 ); } <\/code><\/pre>\n<p>  \u0414\u043b\u044f byte, short \u0438 long, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0431\u0443\u0434\u0443\u0442 <code>0x80<\/code>, <code>0x8000<\/code> \u0438 <code>0x8000000000000000L<\/code>.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-225901","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/225901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=225901"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/225901\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}