Java-реализация Long.numberOfTrailingZeros()JAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Java-реализация Long.numberOfTrailingZeros()

Сообщение Anonymous »

Ссылка на документацию: http://download.oracle.com/javase/6/doc ... %28long%29

Вот исходный код реализации Java:

Код: Выделить всё

/**
* Returns the number of zero bits following the lowest-order ("rightmost")
* one-bit in the two's complement binary representation of the specified
* long value.  Returns 64 if the specified value has no
* one-bits in its two's complement representation, in other words if it is
* equal to zero.
*
* @return the number of zero bits following the lowest-order ("rightmost")
*     one-bit in the two's complement binary representation of the
*     specified long value, or 64 if the value is equal
*     to zero.
* @since 1.5
*/
public static int numberOfTrailingZeros(long i) {
// HD, Figure 5-14
int x, y;
if (i == 0) return 64;
int n = 63;
y = (int)i; if (y != 0) { n = n -32; x = y; } else x = (int)(i>>>32);
y = x 

Подробнее здесь: [url]https://stackoverflow.com/questions/6506356/java-implementation-of-long-numberoftrailingzeros[/url]
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»