Thursday 10 November 2011

Java program to multiply two numbers upto 100000 places

Here's I'd created a Java program by which you can be able to multiply any two integer numbers upto 100000 places.
e.g., if you had to multiply
    99999999999999999999999999999999999999999999999
X  99999999999999999999999999999999999999999999999
--------------------------------------------------------------------------------------------------
*******What will be the output of your program??????*******
--------------------------------------------------------------------------------------------------



Here's my program:


Friday 28 October 2011

Execute DOS command :: JAVA

In the following program I'd tried to open a Notepad using DOS command.
In the same way you can execute other various commands like shutdown your computer or compile a java program.
Here it go:

public class ExecuteDOSCommand{
    public static void main(String... s){
        try{
            Thread.sleep(5000);//the main thread sleep for 5sec. then it execute
            Process p=Runtime.getRuntime().exec("Notepad");//command to open notepad
        }catch(Exception e){
                System.out.println("Sorry! Something went wrong.");
        }
    }
}


Here are other codes you can try:

Process p=Runtime.getRuntime().exec("shutdown -s -t 10");//shutdown your computer after 10sec.