Posts

Showing posts from June 26, 2010

How to convert Integer Array to String in java code examples

public static String arrayToString(Integer[] a, String separator) {     String result = "";     if (a.length > 0) {         result = a[0].toString();    // start with the first element         for (int i=1; i             result = result + separator + a[i];         }     }     return result; }

How to Draw Oval in Applet Java Code example

public static void drawOval(Graphics g, int i, int j, int k, int l, int i1)     {         if(i1 == 1)         {             g.drawOval(i, j, k, l);             return;         }         i -= i1 / 2;         j -= i1 / 2;         k += i1;         l += i1;         for(int j1 = 0; j1 < i1; j1++)         {             g.drawOval(i, j, k, l);             if(j1 + 1 < i1)           ...

How to Draw a circle in Applet java Code example

public static void drawCircle(Graphics g, int i, int j, int k, int l)     {         k += l / 2;         for(int i1 = 0; i1 < l; i1++)         {             drawCircle(g, i, j, k);             if(i1 + 1 < l)             {                 drawCircle(g, i + 1, j, k - 1);                 drawCircle(g, i - 1, j, k - 1);                 drawCircle(g, i, j + 1, k - 1);                 drawCircle(g, i, j...

How to Draw Rectangle in Applet java code?

 // Draw Rectangle in Applet java code public static void drawRect(Graphics g, int i, int j, int k, int l, int i1)     {         i -= i1 / 2;         j -= i1 / 2;         k += i1;         l += i1;         for(int j1 = 0; j1 < i1; j1++)         {             g.drawRect(i, j, k, l);             i++;             j++;             k -= 2;             l -= 2;         }     }

How to calculate no of files in a directory in java code examples

private static int calNoOfFiles(String directoryPath)     {         File fd = new File(directoryPath);         if(!fd.isFile())         {             String list[] = fd.list();             for(int i = 0; i < list.length; i++)             {                 String tempDirPath = directoryPath + fileDelimiter + list[i];                 debug(tempDirPath);                 File ftd = new File(tempDirPath);             ...

How to Draw Line in Applet java code example

public static void drawLine(Graphics g, int i, int j, int k, int l, int i1)     {         if(i1 == 1)         {             g.drawLine(i, j, k, l);             return;         }         int j1 = k;         int k1 = l;         int l1 = i;         int i2 = j;         if(i == k)         {             j1 = (k + i1) - 1;             l1 = (i + i1) - 1;         } else       ...

Recent Post

Recent Posts Widget