Saying all that I still think this is a better code

public class Lottery
{
    static String str="42135";
    int ar[]=new int[20];
    int i=0,j=0,k=0;
    int temp=0;
    public int[] get(char[] str)
    {
        int[] p;
        p = new int[10];
        for(int i=0;i<str.length;i++)
                p[str[i] - '0']++;
        return p;
    }

    public static void main(String arg[])
    {
        Lottery ob=new Lottery();

        int a[] = new int[10];
        try
        {
            a=ob.get(str.toCharArray());
            for(int l=0;l<a.length;l++) {
                for(int i=0; i<a[l]; i++)
                        System.out.print(l);
            }
        }
        catch(Exception e)
        {
            System.out.println("got excep:"+e);
        }
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to