Google
 
Web freesourcecode.blogspot.com
Subscribe to Free Java Source Code !!!

Friday, February 24, 2006

Things That Java Does Not Have



The inventors of Java were C/C++ programmers, and they made conscious decisions to leave out most of the C/C++ features that get programmers into trouble. Not you of course, you are a great programmer and you never make mistakes and your code is wonderful. It's your dumb, lazy, careless coworkers I'm talking about here.

Java has no global variables or functions

Of course you've heard that global variables are evil, but maybe you never really bought into it. You made a variable global "for now" and never got back to making it local. Or you have a variable (probably named something like "DEBUG") that's referenced just about everywhere, so it needed to be global.

Every Java variable is part of some class, so you'll have to change your ways, and you'll feel a lot better about yourself. Looking for the abs() function? It must be in the Math class. Where is "stdin" defined? It's a public static field in the "System" class. Trying to find "atoi()"? Umm...ok, there it is: Integer.parseInt().

Java has no pointer and address operators

That's right, no more "*person" and no more "&person". How about we just use "person" everywhere? Really! Things are much simpler that way.

Java has no "struct" or "union"

A class is a bunch of variables and methods ("method" is just the object-oriented term for "function"). So why do we need a "struct"? It's just a class that happens to have no methods. And a union to save data of one type or another at a single location? That's what subclasses are for. If you don't know what a subclass is yet, don't worry: it's a basic OO concept, and you'll learn it as you learn Java.

Java has no pre-processor and no macros

What do you use your pre-processor for? Let's see...
  • You define your "structs" there, but structs are gone now.
  • You define TRUE and FALSE, but Java has the boolean type built-in.
  • You define some simple function-like macros that are really hard to read and should probably just be functions, but you wanted to save a few milliseconds at runtime when your application ran on a 80286 processor. You're past that now.
  • You have lots of "#ifdefs" to handle various compilers, various Operating Systems, and various hardware. Java takes care of all those inconsistencies for you. "Write Once, Run Anywhere", as they say.

Java does not have "unsigned" types

Was it really worth the two seconds of effort for you to type "unsigned" when you knew your int should never be negative? Was it really worth the savings of two bytes of runtime memory out of the 20 million bytes that your program uses? It's possible, but I doubt it.

Java has no bitfields

Again, do we really need to have the ability to specify a particular number of bits that you need to save a few bits in memory? If you need a one-bit value, use the "boolean" primitive type in Java. If you have a two-bit field, shouldn't you really be using an "enum" anyway and clearly specify what those values are? Please, go back to concentrating on your application and don't worry excessively about wasted bits.

Java has no operator overloading

Ah, yes, operator overloading. The previous developer was so cute to have written:
x = person1 + person2;
The problem is, you don't know what it means to "add two people together". Are you adding their ages? Are they getting married or something perhaps more intimate? In fact, now that you think about it, does "+" really mean much of anything except to add two numbers? OK, ok, let's assume it means to concatenate two Strings together, but that's it. No operator overloading. Just say:
 "person1.marry(person2)"
...using an appropriate method name.

Java has no comma operator

Do we really need this operator in a language? Nah.

Java has no goto statement

You knew this was coming! The "Gotos Considered Harmful" discussion has been going for 35 years now. We're all grownups here. We all know you can write nice code without gotos, and in the very rare case where the code might be a little nicer where we need to break out of a particular nested loop, we can do it. Goto is dead. Long live goto.

Java has no function pointers

The syntax for function pointers is just plain ugly. You can do the same thing in Java, in a cleaner way, using Reflection. For example:
 Method method = Person.class.getMethod("getAddress", null);
// invoke the "getAddress()" method on object "joe"
Object address = method.invoke(joe, null);

Java has no enums

Now how am I going to put a positive spin on Java's lack of a "enum" type? Well, I can't. I wish Java had an enum. But of course, you can make do by defining your own class, and get all the compile-time type-checking that you'd like:
class MarriageStatus {
public static final MarriageStatus SINGLE = new MarriageStatus();
public static final MarriageStatus MARRIED = new MarriageStatus();
public static final MarriageStatus DIVORCED = new MarriageStatus();
}

Java has no "varargs"

There's no need for this "varargs" stuff. If you have a set of fields that you tend to pass around together, put them together into a class and pass an instance of the class around. If you have a function that works on a list of objects (and the list can be any length) then just pass a List object.

Java does not allow multiple inheritence

It's surprising but true: multiple inheritence is way overrated. Sure, you can think of examples where it seems like you'd want multiple inheritence, but in the real world, it's very rare that you want to inherit behaviour from more than one superclass. More often, multiple inheritence is used where a Java interface would be better suited. Say I'm the database guy, and I write a bunch of functions that you call to access the database. How do we formally agree on what functions I provide? I know what you're thinking: I write a superclass that lists all the functions, and then I subclass it and you create an instance and call the methods. That's how it's usually done in C++, but that's not a good way to do it. You shouldn't care what my class is a subclass of, all you should care about is that I have implemented a certain set of methods. That's what an interface is: a list of methods that can be called. In Java, we write an interface (which is just a list of method signatures). I implement the interface, and you call the methods. Trust me, you'll be pleasantly surprised that you don't really need multiple inheritence in the few places where you think you do.

Home

Tuesday, February 21, 2006

Who I am To You ? Hum Aapke Hai Kaun ???? - Source Code For FLAMES

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




Who I Am To You ???
Hum Aapke Hai Kaun??????

F.L.A.M.E.S

By - Krishnkanth Soni

In India, North-Indian teenagers, following small formula for choosing a boyfriend or girlfriend. That is FLAMES. This is a fun application.


What is FLAMES?
F for Friend
L for Lover
A for Affair
M for Marriage
E for Enemy
S for Sister


How the calculation?
Take guy name and girl name
Example: Rama and Sita

1.cut all common letters in those names, now the remaining words are "rma" and "sit"

2.Now calculate all the letters, that is 6 letters

3.Now take FLAMES calculate from the F and cut it on 6th letter

Example:
After cutting the FLAMES
FLAME

4. Now again calculate form the next letter keep on calculate until you will get one letter
that will decide your relationship.

Note: Flames is a funny logic in this testing if this example has caused any problems, please excuse me its only meant for fun!

Download API & Java Source Code For FLAMES here....

/**************************************************************************/
Java Program - Calculating Flames
Author@ Krishnakanth Soni
Feedback@ sonikrishnakanth@gmail.com

Usage: java Flames rama sita
/**************************************************************************/

Output Screen


public class Flames
{
private String name1 = "";
private String name2 = "";

public Flames(){
name1 = "rama";
name2 = "sita";
}

public void setNameOne( String name1 ){
this.name1 = name1.toLowerCase().trim().replaceAll( " ", "" );
}

public void setNameTwo( String name2 ){
this.name2 = name2.toLowerCase().trim().replaceAll( " ", "" );
}

public void setNames( String name1, String name2 ){
this.name1 = name1.toLowerCase().trim().replaceAll( " ", "" );;
this.name2 = name2.toLowerCase().trim().replaceAll( " ", "" );;
}

private String findDifference(){
String difference = "";
String temName = this.name2;
for( int i=0; i<name1.length(); i++ ){
String a = name1.charAt(i) + "";
if( name2.indexOf( a ) != -1 ){
name2 = name2.replaceFirst( a, "" );
}else{
difference += a;
}
}
difference += name2;
this.name2 = temName;
return difference;
}

public String getFLAMES(){
String flamesResult = "";
int difference = findDifference().length();
if( difference == 0 ){
if( name1.equals( name2 ) )
return "You have Given Same Names, So Can't find FLAMES";
else
return "Can't find FLAMES for the Given Names";
}
String fResult[] = { "FRIENDS", "LOVERS", "AFFAIR", "MARRIAGE", "ENEMIES", "SISTERS/BROTHERS" };
int k=0;
for( int i=5; i>0; i-- ){
int j=1;
while( j < difference ){
k++;
if( k == fResult.length )
k = 0;
j++;
}
String fResult1[] = new String[i];
int m = 0;
for( int kk=0; kk fResult.length; kk++ )
if( kk != k )
fResult1[m++] = fResult[kk];
fResult = fResult1;
if( k == fResult.length )
k = 0;
flamesResult = fResult[0];
}
return flamesResult;
}

public String getFLAMES( String name1, String name2 ){
String nameOne = this.name1;
String nameTwo = this.name2;
setNames( name1, name2 );
String flames = getFLAMES();
setNames( nameOne, nameTwo );
return flames;
}

public String toString(){
return "[ F.L.A.M.E.S For \"" + this.name1 + "\" And \"" + this.name2 + "\" Is \"" + getFLAMES() + "\" ] ";
}

public static void main(String[] args)
{
Flames fl = new Flames();
if( args.length == 2 ){
fl.setNames( args[0], args[1] );
System.out.println( "\n" + fl.toString() + "\n" );
System.exit(0);
}else{
System.out.println( "\nUse With Proper usage, Find a sample FLAMES Below\n" );
}
fl.setNames( "rama", "sita" );
System.out.println( "\n" + fl.toString() + "\n" );
}
}

Home

Monday, February 20, 2006

Business Clubbed - Mixture of Two Classes : Animated Number Source Code ...

/*************************************************************************/
Program Printing Number in Digital Format with Animation at Command Prompt
Use of previous classes TypeWriter and DigitalStyle
Author@ krishnakanth Soni
feedback@ sonikrishnakanth@gmail.com

Usage: java AnimateNumber 12345 34567
/************************************************************************/

Output Screen Shot 1

Output Screen Shot 2

Output Screen Shot 3

Download API & Java Source code for AnimatedNumber here...


class AnimateNumber
{
private TypeWriter tw = new TypeWriter();
private DigitalStyle ds = new DigitalStyle();

public void animateNumber( int number ){
tw.type( ds.getDigitalInString( number ) );
}

public void setSpeed( long speed ){
tw.setTypingSpeed( speed );
}

public void setFontSize( int fontSize ){
ds.setFontSize( fontSize );
}

public static void main(String[] args)
{
AnimateNumber an = new AnimateNumber();
an.setSpeed( 50 );
an.setFontSize( 2 );
if( args.length >= 1 ){
for( int i=0; i<args.length; i++ ){
try{
an.animateNumber( Integer.parseInt(args[i]) );
System.out.println( "\n\n" );
}catch(Exception e){}
}
System.exit(0);
}
int a[] = { 23, 4567, 3424, 9898, 5065 };
for( int i=0; i<a.length; i++ ){
an.animateNumber( a[i] );
System.out.println( "\n\n" );
}
}
}

Home




Saturday, February 18, 2006

Business Clubbed - Mixture of Two Classes

You can use the two Classes "TypeWriter" and "Digital Style" to animate a given number.... This is an example of re-usability of software code or procedure :P

Try it and let me know,,, I ll post it soooon

Home

Friday, February 17, 2006

Represent Number in Digital Format - Java



/*************************************************************/
Represents a number in Digital Format
Author @ Krishnakanth Soni

Usage: java DigitalStyle
Example: java DigitalStyle 124 256 5895 1236
/*************************************************************/
Output Screen

Download API & Java Source Code for DigitalStyle here...

public class DigitalStyle
{
private int fontSize;

public DigitalStyle(){
fontSize = 1;
}

public boolean setFontSize( int fontSize ){
if( fontSize >= 2 ){
this.fontSize = fontSize;
return true;
}
return false;
}

//flag[0] = Top Line
//flag[1] = Top Left
//flag[2] = Top Right
//flag[3] = Middle
//flag[4] = Bottom left
//flag[5] = Bottom Right
//flag[6] = Bottom Line
private String[] printZero(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[3] = false;
return printDigitalStyle(flag);
}

private String[] printOne(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[0] = false;
flag[1] = false;
flag[3] = false;
flag[4] = false;
flag[6] = false;
return printDigitalStyle(flag);
}

private String[] printTwo(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[1] = false;
flag[5] = false;
return printDigitalStyle(flag);
}

private String[] printThree(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[1] = false;
flag[4] = false;
return printDigitalStyle(flag);
}

private String[] printFour(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[0] = false;
flag[4] = false;
flag[6] = false;
return printDigitalStyle(flag);
}

private String[] printFive(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[2] = false;
flag[4] = false;
return printDigitalStyle(flag);
}

private String[] printSix(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[2] = false;
return printDigitalStyle(flag);
}

private String[] printSeven(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[1] = false;
flag[3] = false;
flag[4] = false;
flag[6] = false;
return printDigitalStyle(flag);
}

private String[] printEight(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
return printDigitalStyle(flag);
}

private String[] printNine(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[4] = false;
return printDigitalStyle(flag);
}

private String[] getNumber( int number ){
switch(number){
case 1:
return printOne();
case 2:
return printTwo();
case 3:
return printThree();
case 4:
return printFour();
case 5:
return printFive();
case 6:
return printSix();
case 7:
return printSeven();
case 8:
return printEight();
case 9:
return printNine();
case 0:
return printZero();
}
String[] result = new String[1];
result[0] = "Invalid";
return result;
}

private String[] printDigitalStyle( boolean[] flag ){
String digit[] = new String[ (fontSize*2) + 3 ];
//Top
int currentIndex = 0;
digit[currentIndex] = " ";
for( int i=1; i<=fontSize; i++ )
if( flag[0] )
digit[currentIndex] += "-";
else
digit[currentIndex] += " ";
digit[currentIndex] += " ";
currentIndex++;
//left and right legs
for( int i=1; i<=fontSize; i++ ){
digit[currentIndex] = "";
if( flag[1] )
digit[currentIndex] += "|";
else
digit[currentIndex] += " ";
for( int j=1; j<=fontSize; j++ )
digit[currentIndex] += " ";
if( flag[2] )
digit[currentIndex] += "|";
else
digit[currentIndex] += " ";
currentIndex++;
}
//middle
digit[currentIndex] = " ";
for( int i=1; i<=fontSize; i++ )
if( flag[3] )
digit[currentIndex] += "-";
else
digit[currentIndex] += " ";
digit[currentIndex] += " ";
currentIndex++;
//left and right legs
for( int i=1; i<=fontSize; i++ ){
digit[currentIndex] = "";
if( flag[4] )
digit[currentIndex] += "|";
else
digit[currentIndex] += " ";
for( int j=1; j<=fontSize; j++ )
digit[currentIndex] += " ";
if( flag[5] )
digit[currentIndex] += "|";
else
digit[currentIndex] += " ";
currentIndex++;
}
//bottom
digit[currentIndex] = " ";
for( int i=1; i<=fontSize; i++ )
if( flag[6] )
digit[currentIndex] += "-";
else
digit[currentIndex] += " ";
digit[currentIndex] += " ";
return digit;
}

public String[] getDigital( int number )
{
String result[] = new String[ (fontSize*2) + 3 ];
String num = "" + number;
String nums[][] = new String[num.length()][];

for( int i=0; i<num.length(); i++ ){
nums[i] = getNumber( Integer.parseInt(num.charAt(i) + "") );
}

for( int i=0; i<result.length; i++ ){
result[i] = "";
for( int j=0; j<nums.length; j++ )
result[i] += nums[j][i] + " ";
}
return result;
}

public String getDigitalInString( int number ){
String digital[] = getDigital( number );
String result = "";
for( int i=0; i<digital.length; i++ )
result += digital[i] + "\n";
return result;
}
public static void main(String[] args)
{
DigitalStyle ds = new DigitalStyle();
ds.setFontSize(2);
if( args.length >= 1 ){
for( int i=0; i<args.length; i++ ){
try{
String[] digit = ds.getDigital(Integer.parseInt(args[i]));
for( int j=0; j<digit.length; j++ )
System.out.println( digit[j] );
System.out.println( "\n" );
}catch(Exception e){}
}
System.exit(0);
}
int a[] = { 23, 4567, 3424, 9898, 5065 };
for( int i=0; i<a.length; i++ ){
String[] digit = ds.getDigital(a[i]);
for( int j=0; j<digit.length; j++ )
System.out.println( digit[j] );
System.out.println( "\n" );
}
}
}

Home

Thursday, February 16, 2006

Program Printing a Given File in Type Writing Style

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




/***********************************************************/
Program to Print a File in Type Writing Style
- Krishnakanth Soni
sonikrishnakanth@gmail.com
/***********************************************************/
Output Screen
One Charector of file is printed for the specified speed..... So output may be some animation type when you execute.....

Download API and Source Code of TypeWriter here...

import java.io.*;

public class TypeWriter
{
long typingSpeed; //in nano seconds, letter per speed
File fileToType;

public TypeWriter(){
typingSpeed = 100;
fileToType = null;
}

public void setTypingSpeed( long typingSpeed ){
this.typingSpeed = typingSpeed;
}

public void setFileToType( String fileToType ){
if( fileToType.endsWith( ".txt" ) ){
this.fileToType = new File( fileToType );
if( ! this.fileToType.exists() ){
type( "-----------\nFile Not Found.....\n\n" );
System.exit( 0 );
}
}else{
type( "-----------\nFile is Not a Text Document.......\n\n" );
}
if( this.fileToType == null ){
type( "-----------\nFile Not Set.....\n\n" );
System.exit( 0 );
}
}

public void type( String line ){
for( int i=0; i < line.length(); i++ ){
System.out.print(line.charAt(i) + "" );
try{
Thread.sleep( typingSpeed );
}catch(Exception e){}
}
}

public void startTyping(){
if( fileToType == null ){
type( "-----------\nFile Not Set.....\n\n" );
System.exit( 0 );
}
try{
System.out.println( "\n\nFile Typing Started....\n\n" );
BufferedReader br = new BufferedReader( new FileReader( fileToType ) );
String str = "";
while( (str = br.readLine() ) != null ){
type( str );
}
}catch(Exception e){}
}

public static void main( String args[] ){
TypeWriter tw = new TypeWriter();
tw.setTypingSpeed( 50 );
tw.setFileToType( args[0] );
tw.startTyping();
}
}

Home

Wednesday, February 15, 2006

Source Code to Solve SuDoKu - Java

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section


For Sudoku Solver UserInterface click here ...

Sudoku (Japanese: 数独, sūdoku), also known as Number Place, is a logic-based placement puzzle. The aim of the canonical puzzle is to enter a numerical digit from 1 through 9 in each cell of a 9×9 grid made up of 3×3 subgrids (called "regions"), starting with various digits given in some cells (the "givens"). Each row, column, and region must contain only one instance of each numeral. Completing the puzzle requires patience and logical ability. Although first published in a U. S. puzzle magazine in 1979, Sudoku initially caught on in Japan in 1986 and attained international popularity in 2005.

Basic SudoKu Image...


To know more about SuDoKu, visit the following link..
http://en.wikipedia.org/wiki/Sudoku

Download API & Java Source code of SuDoKu here...

/******************************************************/
Program to Solve Given Basic SuDoKu
Krishnakanth. S
sonikrishnakanth@gmail.com
/******************************************************/
Output Screen


See the source code at SuDoKu.java

Home

Java Source Code For Converting a Given "Number" into "Words" ...

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




This program can genrally used by bank applications where you need to convert given "cheque" amount or "DD" amount in "words". or it can be used in any application where you want to display the number in word format. Hope this program works for you. :)


/***************************************************************/

Program to covert a given number in words Format
Author: Krishnakanth Soni
feedback at: sonikrishnakanth@gmail.com

usage: java Converter [list of numbers as arguments]
example: java Converter 1234 3456 4567 4321 9999

/**************************************************************/
Output Screen
Download API & Source Code for Converter here..

public class Converter
{
private double getPlace( String number ){
switch( number.length() ){
case 1:
return DefinePlace.UNITS;
case 2:
return DefinePlace.TENS;
case 3:
return DefinePlace.HUNDREDS;
case 4:
return DefinePlace.THOUSANDS;
case 5:
return DefinePlace.TENTHOUSANDS;
case 6:
return DefinePlace.LAKHS;
case 7:
return DefinePlace.TENLAKHS;
case 8:
return DefinePlace.CRORES;
case 9:
return DefinePlace.TENCRORES;
}//switch
return 0.0;
}// getPlace

private String getWord( int number ){
switch( number ){
case 1:
return "One";
case 2:
return "Two";
case 3:
return "Three";
case 4:
return "Four";
case 5:
return "Five";
case 6:
return "Six";
case 7:
return "Seven";
case 8:
return "Eight";
case 9:
return "Nine";
case 0:
return "Zero";
case 10:
return "Ten";
case 11:
return "Eleven";
case 12:
return "Tweleve";
case 13:
return "Thirteen";
case 14:
return "Forteen";
case 15:
return "Fifteen";
case 16:
return "Sixteen";
case 17:
return "Seventeen";
case 18:
return "Eighteen";
case 19:
return "Ninteen";
case 20:
return "Twenty";
case 30:
return "Thirty";
case 40:
return "Forty";
case 50:
return "Fifty";
case 60:
return "Sixty";
case 70:
return "Seventy";
case 80:
return "Eighty";
case 90:
return "Ninty";
case 100:
return "Hundred";
} //switch
return "";
} //getWord

private String cleanNumber( String number ){
String cleanedNumber = "";

cleanedNumber = number.replace( '.', ' ' ).replaceAll( " ", "" );
cleanedNumber = cleanedNumber.replace( ',', ' ' ).replaceAll( " ", "" );
if( cleanedNumber.startsWith( "0" ) )
cleanedNumber = cleanedNumber.replaceFirst( "0", "" );

return cleanedNumber;
} //cleanNumber

public String convertNumber( String number ){
number = cleanNumber( number );
double num = 0.0;
try{
num = Double.parseDouble( number );
}catch( Exception e ){
return "Invalid Number Sent to Convert";
} //catch

String returnValue = "";
while( num > 0 ){
number = "" + (int)num;
double place = getPlace(number);
if( place == DefinePlace.TENS || place == DefinePlace.TENTHOUSANDS || place == DefinePlace.TENLAKHS || place == DefinePlace.TENCRORES ){
int subNum = Integer.parseInt( number.charAt(0) + "" + number.charAt(1) );

if( subNum >= 21 && (subNum%10) != 0 ){
returnValue += getWord( Integer.parseInt( "" + number.charAt(0) ) * 10 ) + " " + getWord( subNum%10 ) ;
} //if
else{
returnValue += getWord(subNum);
}//else

if( place == DefinePlace.TENS ){
num = 0;
}//if
else if( place == DefinePlace.TENTHOUSANDS ){
num -= subNum * DefinePlace.THOUSANDS;
returnValue += " Thousands ";
}//if
else if( place == DefinePlace.TENLAKHS ){
num -= subNum * DefinePlace.LAKHS;
returnValue += " Lakhs ";
}//if
else if( place == DefinePlace.TENCRORES ){
num -= subNum * DefinePlace.CRORES;
returnValue += " Crores ";
}//if
}//if
else{
int subNum = Integer.parseInt( "" + number.charAt(0) );

returnValue += getWord( subNum );
if( place == DefinePlace.UNITS ){
num = 0;
}//if
else if( place == DefinePlace.HUNDREDS ){
num -= subNum * DefinePlace.HUNDREDS;
returnValue += " Hundred ";
}//if
else if( place == DefinePlace.THOUSANDS ){
num -= subNum * DefinePlace.THOUSANDS;
returnValue += " Thousand ";
}//if
else if( place == DefinePlace.LAKHS ){
num -= subNum * DefinePlace.LAKHS;
returnValue += " Lakh ";
}//if
else if( place == DefinePlace.CRORES ){
num -= subNum * DefinePlace.CRORES;
returnValue += " Crore ";
}//if
}//else
}//while
return returnValue;
}//convert number

public static void main( String args[] ){
Converter cv = new Converter();

if( args.length >= 1 )
{
for( int i=0; i<args.length; i++ )
System.out.println( "Given Number : " + args[i] + "\nConverted: " + cv.convertNumber(args[i]) + "\n\n" );
System.exit(0);
}

System.out.println( "Given Number : 999999999\nConverted: " + cv.convertNumber("999999999") + "\n\n" );
}//main
} //class

class DefinePlace{
public static final double UNITS = 1;
public static final double TENS = 10 * UNITS;
public static final double HUNDREDS = 10 * TENS;
public static final double THOUSANDS = 10 * HUNDREDS;
public static final double TENTHOUSANDS = 10 * THOUSANDS;
public static final double LAKHS = 10 * TENTHOUSANDS;
public static final double TENLAKHS = 10 * LAKHS;
public static final double CRORES = 10 * TENLAKHS;
public static final double TENCRORES = 10 * CRORES;
} //class


Home

Indian Contribution in Globalization

India finds a slot in this "global cultural exchange" through its strength from the knowledge of Upanishads. The major contribution of India, in the world to day, would be in the sphere of spirituality. The rich spiritual heritage of India, as expounded by the Seers in Vedanta and recently in the lives and teachings of Sri Ramakrishna and Swami Vivekananda, is the only 'thing' which India can offer for global prosperity and welfare.

In the global division of labour this work has come to her lot, and re-evaluation of attitudes, values, belief systems in the light of the development of this spiritual knowledge will bring the needed uniformity and universality to the meaning of modernity.

One hundred years back, Swami Vivekananda initiated the process when he said: "Here in this blessed land, the foundation, the backbone, the life-centre is religion and religion alone. Let others talk of politics, of glory of acquisition of immense wealth poured in by trade, of the power and spread of commercialism, of the glorious fountain of physical liberty; but these the Hindu mind does not understand and does not want to understand. Touch him on spirituality, on religion, on God, on the soul, on the Infinite, on spiritual freedom, and I assure you, the lowest peasant in India is better informed on these subjects than many a so-called philosopher in other lands. We have yet something to teach to the world. This the very reason, the raison d'etre, that this nation has lived on, in spite of hundreds of years of persecution, in spite of nearly a thousand years of foreign rule and foreign oppression. This nation still lives; the raison d'etre is, it still holds to God, to the treasure house of religion and spirituality."

He maintained that for humanity to survive and progress, it is essential that rishi culture of yesteryears be re-established in India and thence in the whole world. True religion forms the backbone of Indian culture and ethos, and if that is broken it will cause immense loss to India as well as the global civilization.

That every person should be able to put Vedanta in the practice was the sole purpose of Swami Vivekananda's teaching. He realized the Vedantic principles of divinity of each soul and maintained that religion consists in manifestation of this divinity in every aspect of one's life. He was worried that this universal ideal might gradually get diluted under the barbaric onslaught of combined materialism and 'science without spiritual content'. He clearly saw the West 'as almost borne down, half-killed, and degraded by political ambitions and social scheming.'

Swamiji's plan for educating the masses, emancipation of women, removing the 'blot of untouchability', etc. are a few examples of his love for India so that it could play this role with dignity and poise. There-fore, revival of Indian masses by education, spread of knowledge of physical sciences, and projection of Vedanta as scientific universal religion were a few thoughts uppermost in his mind.

As Swami Ashokananda had said, "Behind all his (Swami Vivekananda's) patriotism, deep down there was the spiritual motive. For him India was synonymous with the spirit of religion. 'If India is to die,' he said, 're-ligion will be wiped off from the face of the earth, and with it the Truth.' He did not want see India as a replica of a Western country. His dream of future India was that along with material prosperity, which would be hers, she would, as the Queen of Nations, extend the hand of peace and blessedness to all peo-ples of the world."

Home

Friday, February 03, 2006

First



hi..

My first post ...