Home > Database > Mysql Tutorial > 把字符串abcdef旋转2位得到字符串cdefab

把字符串abcdef旋转2位得到字符串cdefab

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:43:02
Original
1653 people have browsed it

public class RightShift { public static void main(String args[]) { char[] c = { 'a', 'b', 'c', 'd', 'e' }; for (int i = 0; i c.length; i) { System.out.print(c[i]); } for (int i = 0; i 2; i) { char temp = c[0]; for (int j = 0; j c.length -

public class RightShift {

 public static void main(String args[]) {

  char[] c = { 'a', 'b', 'c', 'd', 'e' };

  for (int i = 0; i    System.out.print(c[i]);
  }

  for (int i = 0; i    char temp = c[0];
   for (int j = 0; j     c[j] = c[j + 1];
   }
   c[c.length - 1] = temp;
  }
  System.out.println();
  for (int i = 0; i    System.out.print(c[i]);
  }
 }

}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template