小编Tok*_*oom的帖子

使用char数组将字符串转换为int

如何创建一个循环,也将字符串"abcc"转换为字母位置的总和,例如a = 1 b = 2 c = 3,它将字符串1 + 2 + 3 + 3 = 9相加.

    import java.util.Arrays;

    public class Test
    {
            public static void main(String[] args)
            {
            String original = "hello";
            char[] chars = original.toCharArray();
            Arrays.sort(chars);
            String sorted = new String(chars);
            System.out.println(sorted);


                }
           }
Run Code Online (Sandbox Code Playgroud)

java string int loops sum

4
推荐指数
1
解决办法
1666
查看次数

标签 统计

int ×1

java ×1

loops ×1

string ×1

sum ×1