整数类highestOneBit()方法 (Integer class highestOneBit() method)

  • highestOneBit() method is available in java.lang package.

    maximumOneBit()方法在java.lang包中可用。

  • highestOneBit() method is used to find almost only single 1's bit from the leftmost side one bit in the path of the highest order of the given parameter [value] of integer type.

    maximumOneBit()方法用于在整数类型的给定参数[value]的最高阶路径中,从最左侧的一位开始几乎只查找一位。

  • highestOneBit() method is a static method, it is accessible with the class name too and if we try to access the method with the class object then also we will not get an error.

    maximumOneBit()方法是一个静态方法,也可以使用类名进行访问,如果我们尝试使用类对象访问该方法,则也不会出错。

  • highestOneBit() method does not throw an exception at the time of determining the highest order bit in single digit.

    maximumOneBit()方法在确定一位数的最高位时不会引发异常。

Syntax:

句法:

    public static int highestOneBit (int value);

Parameter(s):

参数:

  • int value – represents the integer value to be parsed.

    int value –表示要解析的整数值。

Return value:

返回值:

The return type of this method is int, If the given argument is non-zero then, it returns at most only single 1's bit in the path of leftmost side one bit of the given integer value. If the given argument is zero then, it returns the value 0.

此方法的返回类型为int ,如果给定参数为非零,则它在给定整数值的最左侧一位的路径中最多仅返回单个1的位。 如果给定参数为零,则返回值0。

Example:

例:

// Java program to demonstrate the example
// of highestOneBit (int value) method of Integer class
public class HighestOneBitOfIntegerClass {public static void main(String[] args) {int value = 1296;
// It returns the string representation of the given unsigned
// integer value denoted by the argument in binary by calling
// Integer.toBinaryString(value)
System.out.println("Integer.toBinaryString(value): " + Integer.toBinaryString(value));
// It returns the number with atmost 1's bits in the path of leftmost side
// one bit in the given argument 'value' by calling Integer.highestOneBit(value)
System.out.println("Integer.highestOneBit(value): " + Integer.highestOneBit(value));
}
}

Output

输出量

Integer.toBinaryString(value): 10100010000
Integer.highestOneBit(value): 1024

翻译自: https://www.includehelp.com/java/integer-class-highestonebit-method-with-example.aspx

Java Integer类highestOneBit()方法与示例相关推荐

  1. java中intvalue方法作用_Java Integer类intValue()方法及示例

    整数类intValue()方法intValue()方法在java.lang包中可用. intValue()方法用于返回此Integer对象表示的值,该值转换为int类型(通过强制转换). intVal ...

  2. java annotation class,Java Class类 isAnnotation()方法及示例

    Class类isAnnotation()方法isAnnotation()方法在java.lang包中可用. isAnnotation()方法用于检查此Class对象是否表示注释类型. isAnnota ...

  3. java字符类型的返回值,Java字符类isWhitespace()方法及示例

    Character 类isWhitespace()法isWhitespace()方法在java.lang包中可用. isWhitespace()方法用于检查给定的char值是否为空格,但是它包含空格中 ...

  4. java日历类add方法_Java日历computeTime()方法及示例

    java日历类add方法 日历类computeTime()方法 (Calendar Class computeTime() method) computeTime() method is availa ...

  5. java日历类add方法_Java日历computeFields()方法及示例

    java日历类add方法 日历类的computeFields()方法 (Calendar Class computeFields() method) computeFields() method is ...

  6. java日历类add方法_Java日历setFirstDayOfWeek()方法与示例

    java日历类add方法 日历类setFirstDayOfWeek()方法 (Calendar Class setFirstDayOfWeek() method) setFirstDayOfWeek( ...

  7. java日历类add方法_Java日历setMinimalDaysInFirstWeek()方法与示例

    java日历类add方法 日历类setMinimalDaysInFirstWeek()方法 (Calendar Class setMinimalDaysInFirstWeek() method) se ...

  8. java散列法的运用实例,Java HashMap compute() 使用方法及示例

    Java HashMap compute() 使用方法及示例 Java HashMap compute()方法计算一个新值,并将其与哈希映射中的指定键相关联. compute()方法的语法为: has ...

  9. Java——String类的方法

    Java--String类的方法 String str1 = "abc" 与String str2 = new String("abc")有什么区别? 字符串常 ...

最新文章

  1. java画出斜椭圆_【转】画图java源代码,只画直线,矩形,椭圆
  2. 异常: java.security.InvalidKeyException: Illegal key size
  3. 线程信息的获取和设置
  4. CO2 convex sets
  5. 苹果和FBI出庭日期延后
  6. Linux下多线程pthread内存泄露
  7. 期待了1年多了《黑客攻防实战编程》终于面世了!
  8. Access数据库实用教程-----创建更新查询
  9. Z-TEK USB转422接口问题 RS422接口常见使用注意事项
  10. NetSetMan NetSetMan IP快速切换
  11. python3将网页保存为pdf
  12. php 微信代扣开发步骤,PHP实现微信支付(jsapi支付)流程步骤详解
  13. linux系统如何安装bt5,BT5硬盘安装(多系统linux + win + BT5)
  14. 使用M0 DesignStart 的样例SoC(example system) - 4 FPGA原型验证
  15. iOS开发中向iPhone模拟器中添加视频资源
  16. 360浏览器html文件无图标,电脑桌面360浏览器图标不见了解决方法图文教程
  17. 天津天狮学院关于2021年天狮专升本新生入学缴费有关事项的通知
  18. Smplayer命令行模式下的用法
  19. 百度引流推广怎么做?个人如何做百度推广
  20. [凯圣王]减脂挑战第15天变化/饮食思路分享/碳水循环+轻断食/GI值和GL值的应用/碳水后置的理论基础

热门文章

  1. docker linux 快速开窗口_Linux搭建docker环境并简单实用
  2. 3种团队分组适应项目_团队类型
  3. python3.6安装dlib,一直不成功的解决办法
  4. WCF学习笔记(三):开启net.tcp端口
  5. 游戏外挂是怎么炼成的
  6. 获取数据库名称dbName
  7. Gartner: 2017年11大信息安全技术(解读版)
  8. 浅谈Jfinal急速开发框架
  9. FreeSWITCH第三方库(视频)的简单介绍(二)
  10. iOS开发中 常用枚举和常用的一些运算符(易错总结)