首页 > 代码库 > java大小写转换反转

java大小写转换反转

import java.io.*;public class Main {		public static void main(String args[]){				BufferedReader bufReader = new BufferedReader(new InputStreamReader(System.in));								String strBuf;				try {			while ((strBuf = bufReader.readLine()) != null){								System.out.println(cover(strBuf));										}		} catch (IOException e) {			// TODO Auto-generated catch block			e.printStackTrace();		}			}		public static String cover(String str){				int len = str.length();		char[] chs = new char[len];		int j=0;				for(int i=len-1;i>=0;i--){			if(str.charAt(i) != ‘ ‘){				chs[j] = str.charAt(i);				if(chs[j]>=‘a‘&&chs[j]<=‘z‘)					chs[j]-=32;				else if(chs[j]>=‘A‘&&chs[j]<=‘Z‘)					chs[j]+=32;				j++;			}		}		return String.valueOf(chs);	}}