From 977082ceeb120b524e9d810da4ac219b82565b2f Mon Sep 17 00:00:00 2001 From: WeeNews Date: Tue, 24 Dec 2019 20:43:56 +0800 Subject: [PATCH] =?UTF-8?q?Update=203.=20=E6=95=B0=E7=BB=84=E4=B8=AD?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=9A=84=E6=95=B0=E5=AD=97.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notes/3. 数组中重复的数字.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/notes/3. 数组中重复的数字.md b/notes/3. 数组中重复的数字.md index d249e72b..cc86e3b0 100644 --- a/notes/3. 数组中重复的数字.md +++ b/notes/3. 数组中重复的数字.md @@ -49,7 +49,11 @@ private void swap(int[] nums, int i, int j) { nums[j] = t; } ``` - +**`补充:`** +(1)boolean不是占1位,计算机处理处理数据的最小单元是1字节,一般1位的话,其余7位会被0补齐。 +(2)在java虚拟机规范中,JVM没有用于操作boolean的字节码指令,在编译后用int的数据类型代替boolean,此时boolean占4字节。 +(3)boolean[]数组编译后会被byte[]数组代替,此时的boolean占1字节。 +总结:boolean单独存在占4字节,在boolean[]中占1字节。