1个回答
展开全部
import java.io.*;
public class Input1
{
public static void sumChar(byte[] b) //字母统计
{
int n=0;
for (int i=0;i<b.length ;i++ )
{ if(b[i]=='a'||b[i]=='e'||b[i]=='i'||b[i]=='o'||b[i]=='u') n++;}
System.out.println("char count="+n);
}
public static void main(String[] args) throws IOException
{
System.out.println("Input: ");
byte buffer[] = new byte[512]; //输入缓冲区
int count = System.in.read(buffer);
System.out.println("Output: "); //读取标准输入流放入buffer,并返回读取数
for (int i=0;i<count;i++) //输出buffer元素值
{System.out.print(" "+buffer[i]);}
System.out.println();
for (int i=0;i<count;i++) //按字符方式输出buffer
{System.out.print((char) buffer[i]);}
System.out.println("count = "+ count); //buffer实际长度
sumChar(buffer);
}
}
public class Input1
{
public static void sumChar(byte[] b) //字母统计
{
int n=0;
for (int i=0;i<b.length ;i++ )
{ if(b[i]=='a'||b[i]=='e'||b[i]=='i'||b[i]=='o'||b[i]=='u') n++;}
System.out.println("char count="+n);
}
public static void main(String[] args) throws IOException
{
System.out.println("Input: ");
byte buffer[] = new byte[512]; //输入缓冲区
int count = System.in.read(buffer);
System.out.println("Output: "); //读取标准输入流放入buffer,并返回读取数
for (int i=0;i<count;i++) //输出buffer元素值
{System.out.print(" "+buffer[i]);}
System.out.println();
for (int i=0;i<count;i++) //按字符方式输出buffer
{System.out.print((char) buffer[i]);}
System.out.println("count = "+ count); //buffer实际长度
sumChar(buffer);
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询