日期:2014-05-20 浏览次数:20889 次
import java.io.*; public class Wo { public static void;i<buff.length;i++){ 3 int b=0; 4 for (int j=0;j<8;j++){ 5 int bit = (buff[i]>>j&1)==0?1:0; 6 b += (1<<j)*bit; 7 } 8 buff[i]=[byte]b; 9 } 10 return buff; 11 }
------解决方案--------------------
你应该用Scanner 参考一下这个: 控制台键盘输入(System.in)
------解决方案--------------------
Essentials of the Java Programming Language, Part 1
By Monica Pawlan
The computer age is here to stay. Households and businesses all over the world use computers in one way or another because computers help individuals and businesses perform a wide range of tasks with speed, accuracy, and efficiency. Computers can perform all kinds of tasks ranging from running an animated 3D graphics application with background sound to calculating the number of vacation days you have coming to handling the payroll for a Fortune 500 company.
When you want a computer to perform tasks, you write a program. A program is a sequence of instructions that define tasks for the computer to execute. This lesson explains how to write, compile, and run a simple program written in the Java language (Java program) that tells your computer to print a one-line string of text on the console.
But before you can write and compile programs, you need to understand what the Java platform is, and set your computer up to run the programs.
A Word About the Java Platform
The Java platform consists of the Java application programming interfaces (APIs) and the Java virtual machine (JVM).
Java APIs are libraries of compiled code that you can use in your programs. They let you add ready-made and customizable functionality to save you programming time.
The simple program in this lesson uses a Java API to print a line of text to the console. The console printing capability is provided in the API ready for you to use; you supply the text to be printed.
Java programs are run (or interpreted) by another program called the Java VM. If you are familiar with Visual Basic or another interpreted language, this concept is probably familiar to you. Rather than running directly on the native operating system, the program is interpreted by the Java VM for the native operating system. This means that any computer system with the Java VM installed can run Java programs regardless of the computer system on which the applications were originally developed.
For example, a Java program developed on a Personal Computer (PC) with the Windows NT operating system should run equally well without modification on a Sun Ultra workstation with the Solaris operating system, and vice versa.
Setting Up Your Computer
Before you can write and run the simple Java program in this lesson, you need to install the Java platform on your computer system.