public class Test1 {
public static int compare(String s1, String s2)
{
return s1.toLowerCase().compareTo(s2.toLowerCase());
}
public static void main(String[] args) {
String str1 = "abcdeb";
String str2 = "ABCDEa";
System.out.println(compare(str1,str2));
}
}
public class Test12 {
public static int[] findMin(int[][] inArr) {
int maxLength = 0;
for (int i = 0; i < inArr.length; i++) {
if (inArr[i].length > maxLength) {
maxLength = inArr[i].length;
}
}
int[] outArr = new int[maxLength];
for (int column = 0; column < maxLength; column++) {
outArr[column] = Integer.MAX_VALUE;
for (int row = 0; row < inArr.length; row++) {
if (column < inArr[row].length) {
if (inArr[row][column] < outArr[column]) {
outArr[column] = inArr[row][column];
}
}
}
}
return outArr;
}
public static void main(String[] args) {
int[][] inArr = new int[][] { { 1, 8, 3 }, { 6, 5 } };
System.out.println(Arrays.toString(findMin(inArr)));
}
}
public class Test3 {
public static boolean getBoolean(String str){
boolean result = false;
for(int i=1;i<str.length();i++){
if(Character.isLowerCase(str.charAt(i))){
if(Character.isUpperCase(str.charAt(0))){
result = true;
}
}
}
return result;
}
public static void main(String[] args) {
System.out.println(getBoolean("true"));
}
}
public class Test4 {
public static String sort(String str){
StringBuffer sb1 = new StringBuffer();
StringBuffer sb2 = new StringBuffer();
if(!str.isEmpty()){
for(int i=0;i<str.length();i++){
char c = str.charAt(i);
if((c>=97&&c<=122)||(c>=65&&c<=90)){
sb1.append(c);
}else if(c>=48&&c<=57){
sb2.append(c);
}
}
}
return sb1.append(sb2).toString();
}
public static void main(String[] args) {
System.out.println(sort("asdg1233asdfg12323"));
}
}
public class Test5 {
public static String truck(String str){
String[] words = str.split(" ");
int max = words[0].length();
int index = words.length-1;
for(int i=words.length-1;i>=0;i--){
if(words[i].length()>=words[index].length()){
index = i;
}
}
return words[index];
}
public static void main(String[] args) {
System.out.println(truck("asas eeee ererererer dfdfdfdfddeeeeeeeee dfdfdfdfddeeeeeeeee gg ssssss"));
}
}
public class Test6 {
public static String getSubStr(String str)
{
Map<Character,Integer> map = new HashMap<Character, Integer>();
if(!str.isEmpty())
{
char c;
for (int i = 0; i < str.length(); i++)
{
c = str.charAt(i);
if(map.containsKey(c))
{
map.put(c, map.get(c)+1);
}
else
{
map.put(c, 1);
}
}
Object[] o = map.values().toArray();
int max = Integer.parseInt(o[0].toString());
for (int i = 1; i < o.length; i++)
{
if(Integer.parseInt(o[i].toString()) >= max)
{
max = Integer.parseInt(o[i].toString()); //计算出最大出现次数
}
}
String k;
int v;
List<Character> list = new ArrayList<Character>();
Iterator iterator = map.keySet().iterator();
while(iterator.hasNext())
{
k = iterator.next().toString();
v = map.get(k.charAt(0));
if(v == max)
{
list.add(k.charAt(0));
}
}
for (int i = 0; i < list.size(); i++)
{
str = str.replaceAll(list.get(i).toString(), "");
}
return str;
}
return "";
}
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
System.out.println("原字符串:" + s);
System.out.println("截取后的字符串:" + getSubStr(s));
sc.close();
}
}
public class Test7 {
public static char[] arr = {1,2,5,6,26};
public static String convert(char[] n)
{
int index = 0;
StringBuffer s = new StringBuffer();
for (char i = 'a'; i <= 'z'; i++) //97~122
{
for (char j = 0; j < n.length; j++)
{
if(n[j] == (index + 1))
{
n[j] = i;
}
else if((n[j] > 26 || n[j] < 1) && n[j] < 97 && n[j] > 122)
{
n[j] = '?';
}
}
index++;
}
for (int i = 0; i < n.length; i++)
{
s.append(n[i] + " ");
}
return s.toString();
}
public static void main(String[] args)
{
System.out.println("翻译之后的字母:" + convert(arr));
}
}
public class Test10 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s ="";
do{
System.out.println("请输入一个大写字母:");
s = sc.next();
if(!s.isEmpty()){
if(s.length()>1){
System.out.println("不合法的输入");
}else if(s.codePointAt(0)<'A'||s.codePointAt(0)>'Z'){
System.out.println("输入不合法");
}else{
s = s.toLowerCase();
int c = s.codePointAt(0)+5;
if(c>122){
c = c-122+97-1;
}
char ch = (char)c;
System.out.println("转换后:"+ch);
}
}
System.out.println("任意键继续,N退出");
String aa = sc.next();
if(aa.equalsIgnoreCase("n")){
break;
}
}while(true);
sc.close();
}
}
public class Test13 {
public int gegtreatestCommonDivisor(int num1, int num2){
int result = 1;
int i = (num1>num2?num2:num1);
for(int j=1;j<=i;j++){
if(num1%j==0&&num2%j==0){
result = j;
}
}
return result;
}
public static void main(String[] args) {
Test13 t13 = new Test13();
System.out.println(t13.gegtreatestCommonDivisor(26, 38));
}
}