How do I shift array characters to the right in Java?

前端 未结 2 478
轮回少年
轮回少年 2021-01-20 02:14

This is what I have:

class encoded
{
    public static void main(String[] args)
    {
        String s1 = \"hello\";
        char[] ch = s1.toCharArray();
           


        
2条回答
  •  無奈伤痛
    2021-01-20 02:30

    Replace i - 'a' + 1 with ch[i] - 'a' + 1

    class encoded {
    
       public static void main(String[] args)
       {
         String s1 = "hello";
         char[] ch = s1.toCharArray();
         for(int i=0;i

提交回复
热议问题