java将boolean值转为short
1、将hutool的jar包引入到你的工程项目中

2、创建一个boolean类型的值默认为true

3、short toShort = BooleanUtil.toShort(b);//将布尔类型转换为short

4、运行程序查看得到的值为1

5、将值改为false,再次运行查看结果

1、将hutool的jar包引入到你的工程项目中
2、创建一个boolean类型的值默认为true
3、short toShort = BooleanUtil.toShort(b);//将布尔类型转换为short
4、运行程序查看得到的值为1
5、将值改为false,再次运行查看结果