⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 circle.java

📁 用java实现简单的:简单聊天程序 多线程 计数器 记事本 马鞍点 扇子 学生成绩管理系统 异常处理 字符串类
💻 JAVA
字号:
import java.io.*;
import java.lang.String.*;

class SortClass//类定义开始
 { void sort(String arr[])//开始定义冒泡排序方法sort
    { int i,k;
    String temp;
     int len=arr.length;
       for(i=0;i<len-1;i++)
        for(k=len-1;k>i;k--)
         if( arr[k].compareTo(arr[k-1])<0)
           { temp=arr[k-1];
             arr[k-1]=arr[k];
             arr[k]=temp;  
  	      }//if块结束,同时使内循环for(k……)和外循环for(i……)结束
      }//sort方法结束
  }//类SortClass定义结束

public class circle
{
	public static void main(String args[] )
     { 
        byte a[]=new byte[256]; 
     	int count,charcount=0; 
    //	int b[] =new int[32];
     	String str,str1,str2; 
     	int flag=1; 
     	int t1,t2;
     	  String[] m; 	
     	
     	
     	String c1;
     int arr[]=new int[8];
     int len=arr.length;
     BufferedInputStream in =new BufferedInputStream(System.in);
     //BufferedInputStream inkey =new BufferedReader(new InputStreamReader(System.in));

    // System.out.println(" qingshuruzifi" );
    // for(int x=0;x<len;x++)
    //  { c1=inkey.readLine();   //用于读取一个字符串
     //   arr[x]=Integer.parseInt(c1);//将字符串类型c1转换成整数类型
     // }
        try{ 
     	     count=in.read(a); 
     	     str=new String(a,0,count);  
     	     m= str.split(" ");     	        
     	     t1=m[0].compareTo(m[1]); 	         	    
            t2=1;
     	    // b=Integer.parseInt(a);
     	     // for(int j=0;j<count-2;j++)
     	     //  if(b[j]==null)charcount++;   	     	        
     	     for(int i=0;i<(count-2)/2;i++)
     	     if(a[i]!=a[count-3-i])flag=0;
     	       if(flag==0)System.out.print("This string is not circle!");
               else System.out.print("This string is  circle!The numble of word is :"+m.length);
                System.out.println("\n");   
           SortClass p1=new SortClass();
         p1.sort(m);//实参为数组名
   System.out.println("按字典顺序排序进行排序并输出结果:");
    for(int n=0;n<m.length;n++)
     System.out.print(" "+m[n]);
         }
         catch(IOException E)
         {
         	System.out.print("There are wrong with I/O");
         }           	
     	}		
	} 
	
 

    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -