Showing posts with label read from command line. Show all posts
Showing posts with label read from command line. Show all posts

Tuesday, February 23, 2010

Command line Reader Sample

import java.io.*;
import java.lang.*;

public class DecimalToOctal {
public static void main(String[] args) throws IOException{
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the decimal number:");
String deci = buff.readLine();
int value = Integer.parseInt(deci);
String str = Integer.toString(value,8);
System.out.println("octal:=" + str);
}
}