当前位置:网站首页>Integer learning
Integer learning
2022-07-07 14:54:00 【nsnsttn】
/** * @author zzy * @createDate: 2021-11-29 10:24:15 * @description: The source code is relatively simple , Click inside by yourself */
public class Integer Study {
public static void main(String[] args) {
// One : Four kinds of creation Integer Methods , The first three values are -128 ~ 127 Cache this value between
//1.String turn int, Then it is automatically boxed, so there is a cache , The second parameter is base , The default is 10 Base number
Integer i1 = Integer.parseInt("127");
//2.String、int turn Integer, With cache , The second parameter is base , The default is 10 Base number
Integer i2 = Integer.valueOf(127);
//3. Automatic boxing , Automatically call valueOf()
Integer i3 = 127;
//4. Create new objects , No cache
Integer i4 = new Integer(127);
Integer i5 = 127;
System.out.println(i1 == i5);//true
System.out.println(i2 == i5);//true
System.out.println(i3 == i5);//true
System.out.println(i4 == i5);//false
// Two : Hexadecimal conversion
// 10 turn 2
String t2 = Integer.toBinaryString(11);
// 10 turn 8
String t8 = Integer.toOctalString(20);
// 10 turn 16
String t16 = Integer.toHexString(20);
System.out.println(t2);
System.out.println(t8);
System.out.println(t16);
}
}
边栏推荐
猜你喜欢

C 6.0 language specification approved

In the field of software engineering, we have been doing scientific research for ten years!

CPU与chiplet技术杂谈

Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?

Apache多个组件漏洞公开(CVE-2022-32533/CVE-2022-33980/CVE-2021-37839)

Niuke real problem programming - day16

CTFshow,信息搜集:web1

Infinite innovation in cloud "vision" | the 2022 Alibaba cloud live summit was officially launched

Instructions d'utilisation de la trousse de développement du module d'acquisition d'accord du testeur mictr01

#yyds干货盘点# 解决名企真题:交叉线
随机推荐
What is cloud primordial? This time, I can finally understand!
Read PG in data warehouse in one article_ stat
Wechat applet - Advanced chapter component packaging - Implementation of icon component (I)
Bill Gates posted his resume 48 years ago: "it's not as good-looking as yours."
Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
PyTorch模型训练实战技巧,突破速度瓶颈
「2022年7月」WuKong编辑器更版记录
Es log error appreciation -trying to create too many buckets
"July 2022" Wukong editor update record
Pandora IOT development board learning (HAL Library) - Experiment 12 RTC real-time clock experiment (learning notes)
大厂做开源的五大痛点
全球首款 RISC-V 笔记本电脑开启预售,专为元宇宙而生!
13 ux/ui/ue best creative inspiration websites in 2022
CTFshow,信息搜集:web13
Shengteng experience officer Episode 5 notes I
Read PG in data warehouse in one article_ stat
What is the process of ⼀ objects from loading into JVM to being cleared by GC?
Data connection mode in low code platform (Part 2)
Novel Slot Detection: A Benchmark for Discovering Unknown Slot Types in the Dialogue System
缓冲区溢出保护