gpt4 book ai didi

Java将int数组中的2位十进制转换为BCD

转载 作者:太空宇宙 更新时间:2023-11-04 06:13:58 28 4
gpt4 key购买 nike

我需要将两位十进制数转换为 int 数组。例如,如果我们假设我有数字 32,我想将其转换为 int[] a = new int[2],其中 int[0] = 3int[1] = 2

最佳答案

您可以尝试:

int x = 32;
int[] array = { x / 10, x % 10 };

关于Java将int数组中的2位十进制转换为BCD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28338995/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com