skip to main | skip to sidebar

Java Programs and Examples with Output

Pages

  • Home
 
  • RSS
  • Twitter
Showing posts with label CSV Example. Show all posts
Showing posts with label CSV Example. Show all posts
Saturday, October 20, 2012

Convertion of CSV to Table

Posted by Raju Gupta at 4:30 PM – 0 comments
 
It converts the comma seperated value file to a table in database.

/*
 * This program used to convert data from CSV file to TABLE

 */

import java.sql.*;
import java.io.*;
public class ConvertCSVtoTABLE {
    
    public void covertCsvtotable(String file)
    {
        Connection conn;
        conn=null;
        ResultSet rs;
        Statement stmt;
        String Query="";
        try
        {
            /*****This program connect with MS-ACCESS DATABASE******/
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            conn=DriverManager.getConnection("jdbc:odbc:DB");
            stmt = conn.createStatement();
             /******************************************************/
      
            
            int noofcolumn=1,b,bprev,i;
            String text1="'";
            String filename=file;
            FileReader fin=new FileReader(filename);
            BufferedReader bf=new BufferedReader(fin);
            b=bf.read();
            while(b!=-1){
                bprev=b;
                if(b==44)
                {
                    text1=text1+"'";
                    noofcolumn=noofcolumn+1;
                }
                if(b==10)
                {
                     text1=text1+"'";
                     Query="insert into temptable(";
                     for(i=1;i<noofcolumn;i++)
                         Query=Query+"col"+i+",";
                     Query=Query+"col"+i;
                     Query=Query+") values("+text1+")";
                     stmt.executeUpdate(Query);
                     text1="'";
                     noofcolumn=1;
               }
               if(b!=34 && b!=10)
                {
                     text1=text1+(char)b;
                }
               b=bf.read();
               if(bprev==44)
                     text1=text1+"'";
             }
            
            fin.close();
            bf.close();
            conn.close();
            System.out.println("Data Transferred from CSV to TempTable Successfully :)");
         }
  
        catch(Exception E)
        {
             System.out.println(E);
        }        
    }
    
  public static void main(String[] args) 
    {
          ConvertCSVtoTABLE C=new ConvertCSVtoTABLE();
          C.covertCsvtotable("C:\Users\Raj\input.csv");
        
    }
}

[ Read More ]
Read more...
Wednesday, October 17, 2012

Parsing a csv file containing data to be saved into database

Posted by Raju Gupta at 3:00 AM – 0 comments
 
The code helps in parsing data prsent in a comma separated value format in a file to be uploaded in the database. It checks whether the first token of each line in the csv file is empty or not.

public static void parsingData(String uploadFile, FileValueBinder binder) throws FileFormatException {
  int lineNumber = 1;
 String DELIM_STR = "\r\n";
        StringTokenizer lineTokenizer = new StringTokenizer(uploadFile, DELIM_STR);

  line: 
        while (lineTokenizer.hasMoreTokens()) {

            String tokenVal = lineTokenizer.nextToken();
                   
            // tokenize as CSV         
            String nextToken = null;

            String prevToken = "";

            int counter = 0;

            int parseErrorLocation = 0;

            ArrayList errors = new ArrayList();

            ArrayList values = new ArrayList();

            int indexValue=0;

            // returns the index value of the first comma character in the csv file
            indexValue=tokenVal.indexOf(",");

            // check if the comma char is at 0th position 
            if(indexValue==0){
            
             try {
                   throw new FileFormatException("");
                } catch (Exception ex) {
                    throw new FileFormatException("Please enter a valid value at line number: "+lineNumber+ex.getMessage());
                }
            }

           SampleTokenizer commaTokenizer = new SampleTokenizer(tokenVal, DELIM_CHAR);
           
            while (commaTokenizer.hasMoreTokens()) {
                nextToken = commaTokenizer.nextToken();
                values.add(nextToken);
            }

            //pad the values if required.
            if (counter == (binder.getExpectedNumberOfValues() - 1)) {
                values.add(null);
            }

            Iterator valuesIt = values.iterator();
            counter = 0;

            while (valuesIt.hasNext()) {
                String nextValue = (String) valuesIt.next();
                try {
                    binder.addNextToken(nextValue);
                } catch (ParseException e) {
                    errors.add(e);
                    parseErrorLocation = counter;
                    err = true;
                }

                counter++;
            }
           
            
            

            lineNumber++;
        }

        try {
            binder.eof();
        } catch (ParseException e) {
            try {
               //Exception
            } catch (Exception ex) {
                throw new FileFormatException(ex.getMessage());
            }
        }
   }

  }


The SampleTokenizer refers to the following:

 public SampleTokenizer(String str,String delim)
  {
   
    super(str,delim);
    this.string = str;
    this.delim= delim;
    isCountTokensCalled = false;
    tokenList = new ArrayList();

  }
  


 public SampleTokenizer(String str,String delim, String escape)
  {
   
    super(str,delim);
    this.string = str;
    this.delim= delim;
    isCountTokensCalled = false;
    tokenList = new ArrayList();
    this.ESCAPE_STR = escape;
  }

  public int countTokens() {
    isCountTokensCalled = true;
    String value="";

    while (cursorPos < string.length()) {
      if (String.valueOf(string.charAt(cursorPos)).equals(this.ESCAPE_STR) && !isEscape) {
        isEscape = true; 
        escapeStart = currentPos;
      } else if (String.valueOf(string.charAt(cursorPos)).equals(this.ESCAPE_STR) && isEscape) {
        isEscape = false;
        escapeEnd = currentPos;
      } else if (!isEscape && (String.valueOf(string.charAt(cursorPos)).equals(this.delim))) {
        currentPos = cursorPos;
        value = string.substring(previousPos,currentPos);
        if ("".equals(value))
          value = null;
        tokenList.add(count,value);
        count++;
        previousPos = currentPos+this.delim.length();
      } 
      if (cursorPos == string.length()-1 && !(String.valueOf(string.charAt(cursorPos)).equals(this.delim))) {

        value = string.substring(previousPos);
        if (value.equals(""))
          value = null;
        tokenList.add(count,value);
      }
      cursorPos++;      
    } 

    
    if (string.endsWith(",")){
      
      tokenList.add(count,null);
      count++;
    } else count++;
    
    return count;    
  }
  
  public boolean hasMoreTokens()  {

      if (!isCountTokensCalled)
        this.countTokens();
      if (count > tokenPos)
        return true;
      return false;
  }

  public String nextToken() {
    String token = (String)tokenList.get(tokenPos);
    tokenPos++;
    return token;
    
  }


[ Read More ]
Read more...
Saturday, October 13, 2012

Export to CSV from JSP Page

Posted by Raju Gupta at 5:00 PM – 0 comments
 
The code snippet helps to export data from a jsp page which has fetched data from SQL Database into CSV format.

private static  void writeCsv(FileWriter writer , String [] array ) throws Exception{
  try{
   int sizeOfArr = array.length;
   int index = 0; 
   while(index < sizeOfArr){
    writer.append(array[index] == null ? "" : array[index]);
    if( index != (sizeOfArr-1)){
     writer.append(",");
    }else{
     writer.append('\n');
    }
    index++;
   }
  }catch(Exception e){
    e.printStackTrace();
    throw e;
  }
 }


[ Read More ]
Read more...
Sunday, September 16, 2012

Parsing CSV file

Posted by Admin at 12:56 AM – 0 comments
 

It describes, parsing a CSV file without using StringTokenizer in java


import java.io.*;
public class Test {

 public static void main(String args[]) throws IOException {
  String thisLine;
  String[] fullText = new String[100]; //number of possible lines in your file
  int counter = 0;
  String fName = "C:/Users/Desktop/345_APPLE.txt";
  FileInputStream fis = new FileInputStream(fName);
  DataInputStream myInput = new DataInputStream(fis);
  while ((thisLine = myInput.readLine()) != null) {
   System.out.println("---------------------------------\nBegin Parsing");

   int sPos = 0;
   int ePos = 1;
   int tDelim = 0;
   String d = "";
   int colCount = 0;
   int collCount = 0;
   boolean fMe = false;
   boolean finalCol = false;
   while ( ePos < thisLine.length()) {
    sPos = thisLine.indexOf(",", ePos);
    tDelim = thisLine.indexOf(",\"", ePos);

    if (tDelim == ePos) {
     fMe = true;
     collCount = ePos + 1;
     while (collCount <= thisLine.indexOf("\",")) {
      collCount += 1;
     }
     colCount += 1;
     sPos = collCount;
    }

    if (colCount == 47) { //Get Max count of columns
     finalCol = true;
     collCount = ePos + 1;
     while (collCount <= thisLine.lastIndexOf("\"")) {
      collCount += 1;
     }
     colCount += 1;
     sPos = collCount;
    }

    if (sPos == -1) {
     d = thisLine.substring(ePos,thisLine.length()); 
     System.out.println(d);
     break;
    }else if(ePos == 1) {
     d = thisLine.substring(ePos-1,sPos);
     System.out.println(d);
    }else{
     if (fMe) {
      d = thisLine.substring(ePos + 1, sPos);
      fMe = false;
     }else if (finalCol) {
      d = thisLine.substring(ePos, sPos);
      finalCol = false;
     }else{
      d = thisLine.substring(ePos, sPos);
     }
     System.out.println(d);
    }

    colCount += 1;
    ePos = sPos + 1;
   }
   counter++;
   fullText[counter] = thisLine;
   System.out.println("\nEnd Parsing\n---------------------------------\n\n");
  }
 }

}

[ Read More ]
Read more...

CSV File reader using java

Posted by Admin at 12:52 AM – 0 comments
 

Code used for reading the CSV file format which will be one of the standard format of file type. Usingthis code One can be able to read the content of the csv file for data processing for further validation


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.StringTokenizer;
public class TestGrid {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  String fileName="C:/APPLE.csv";
  try {
   BufferedReader br = new BufferedReader( new FileReader(fileName));
   String strLine = null;
   StringTokenizer st = null;
   int lineNumber = 0, tokenNumber = 0;
   while( (fileName = br.readLine()) != null)
   {
    lineNumber++;
    //break comma separated line using ","
    st = new StringTokenizer(fileName, ",");
    while(st.hasMoreTokens())
    {
     //display csv values
     tokenNumber++;
     System.out.println("Line # " + lineNumber +
       ", Token # " + tokenNumber
       + ", Token : "+ st.nextToken());
    }
    //reset token number
    tokenNumber = 0;
   }
  }
  catch (FileNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }
}

[ Read More ]
Read more...
Friday, September 14, 2012

Upload Multiple CSV File Parallel | Java Example

Posted by Admin at 12:39 PM – 0 comments
 

This application can be used to upload mulitple csv files parallely using edbloader and insert data in table of PostgreSQL.


import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;


public class ImplementPlLoader {

 private String ImplementPlLoader1(String csvFile, String badFile,String ctlFile, String parFile, String logFile,String edbLoaderpath,String tableName, int num) throws Exception 
 {
  String[] edbLoaderpathStr = edbLoaderpath.split(",");
  String[] csvFileStr = csvFile.split(",");
  String[] badFileStr = badFile.split(",");
  String[] ctlFileStr = ctlFile.split(",");  
  String[] parFileStr = parFile.split(",");
  String[] logFileStr = logFile.split(",");
  String parFileData;
  String ctlData;
  boolean success = false;
  String[] cmd = new String[2];
  String exitValue = "";
  
  for(int i=0; i<num; i++)
  {
   System.out.println("edbLoaderpathStr["+i+"]-"+edbLoaderpathStr[i]);
   if(!(new File(edbLoaderpathStr[i])).exists())
    (new File(edbLoaderpathStr[i])).mkdirs();
   
   System.out.println("csvFileStr[i].... "+csvFileStr[i]);
   System.out.println("badFileStr[i].... "+badFileStr[i]);
   System.out.println("ctlFileStr[i] "+ctlFileStr[i]);
   System.out.println("parFileStr[i] "+parFileStr[i]);
   System.out.println("logFileStr[i] "+logFileStr[i]);
   
   if (!(new File(edbLoaderpathStr[i]+csvFileStr[i])).exists())
    return "Fail1";
   
   parFileData = "CONTROL="+ctlFileStr[i]+" BAD="+badFileStr[i]+" LOG="+logFileStr[i];
   System.out.println("parFileData: "+parFileData);

   ctlData = "LOAD DATA INFILE '"+edbLoaderpathStr[i]+csvFileStr[i]+"' INTO TABLE "+tableName+" APPEND FIELDS TERMINATED BY ','  OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS (empid,empname)";
   System.out.println("ctlData :: " + ctlData);
   
   if ((new File(edbLoaderpathStr[i]+ctlFileStr[i])).exists())
    success=(new File(edbLoaderpathStr[i]+ctlFileStr[i])).delete();
   else
    new File(edbLoaderpathStr[i]+ctlFileStr[i]).createNewFile();

   BufferedWriter out = new BufferedWriter(new FileWriter(edbLoaderpathStr[i]+ctlFileStr[i]));
   out.write(ctlData);
   out.close();

   System.out.println("ctl file success :::" +success);

   /** Creating para file */
   if ((new File(edbLoaderpathStr[i]+parFileStr[i])).exists())
    success=(new File(edbLoaderpathStr[i]+parFileStr[i])).delete();
   else
    new File(edbLoaderpathStr[i]+parFileStr[i]).createNewFile();

   BufferedWriter outParFile = new BufferedWriter(new FileWriter(edbLoaderpathStr[i]+parFileStr[i]));
   outParFile.write(parFileData);
   outParFile.close();

   System.out.println("Para file success :::" +success);
   
   cmd[0]="edbldr";
   cmd[1]=" -d SAM -p 5444 -h localhost USERID=enterprisedb/Admin@123 DIRECT=TRUE PARALLEL=TRUE PARFILE="+parFileStr[i];
   System.out.println("cmd[0] "+cmd[0]);

   String[] env=null;
   Process p = null;

   int iReturn=1;
   long start=System.currentTimeMillis();
   long end=System.currentTimeMillis();

   System.out.println("start:"+start);
   
   while(iReturn!=0 && (end-start)/1000<=5)
   {
    Runtime rt = Runtime.getRuntime();
    p = rt.exec(cmd,env,new File(edbLoaderpathStr[i]));
    iReturn = p.waitFor();
    end=System.currentTimeMillis();
    System.out.println("end:"+end);
    System.out.println("iReturn:"+iReturn);
    System.out.println("exitVal:"+p.exitValue());

    if(p.exitValue()==2)
    {
     exitValue= "2";   // row discarded
     break;
    }
   }
   if((new File(badFile)).exists())
    return "-1";

   if(exitValue.equals("2"))  // row discarded
    return "-2";
  }
  
  return "1";
 }
 
 public static void main(String[] args) throws Exception {
  ImplementPlLoader implPlLoader =  new ImplementPlLoader();
  
  String csvFile = "empFileCsv1.csv,empFileCsv2.csv"; // Name of Csv Files
  String badFile = "empFileBad1.bad,empFileBad2.bad"; 
  String ctlFile = "empFileCtl1.ctl,empFileCtl2.ctl";
  String parFile = "empFilePar1.par,empFilePar2.par";
  String logFile = "empFileLog1.log,empFileLog2.log";
  
  String edbLoaderpath = "D://Sam//edbldr1//,D://Sam//edbldr2//";
  String tableName = "EMP_PL";
  String str = implPlLoader.ImplementPlLoader1(csvFile,badFile,ctlFile,parFile,logFile,edbLoaderpath,tableName,2);
  System.out.println("return str "+str);
  
  if(str.equals("Fail1"))
   System.out.println("Data file doesnot exist");
 }

 

}

[ Read More ]
Read more...
Older Posts
Subscribe to: Posts ( Atom )

List of Java Programs

  • Java Program to check Greater between the Two Number
  • Java Program to find that given number is Palindrome or not
  • Java Program to Demonstrate the Use of Pre and Post Operator
  • Java Program to Reverse the Given Number
  • Java Program to Print Number in the Given Data Type
  • Program to Demonstrate Skipping using Continue
  • Program to find whether entered character is a vowel or Consonant
  • Java Program to Calculate the Sum of Digits of Given Number
  • How to swap two numbers using only two variables
  • Checking the Given Number is Armstrong or Not
  • Average an Array of Values
  • Display ASCII Code Instead of Character
  • Comparison of Two Variable using If
  • Printing Table In java using While Loop
  • Generate Random Number Using Math.Random Function
  • To Find roots of Quadratic Equation
  • Performing Arithmetic Opration on Two Variable
  • Concatenation of Two String in Java
  • Command Line Argument in JAVA
  • Java Hello World Program
  • Calculate Circle Perimeter | Java Program
  • Calculate the Area of Circle | Java Program
  • To Find Whether Given Year is a Leap Year or not
  • Popular
  • Recent
  • Archives

Total Pageviews

Sparkline

Followers

Popular Posts of This Week

  • program to retrieve Method names of a class
    import java.lang.reflect.*; public class Refl6 { public static void main(String args[]) throws Exception { Class c=Class.forN...
  • To Sort an Interger Array using Shell Sort
    To Sort an Interger Array using Shell Sort class ShellSort { public static int[] shellSort(int[] array) { int N = array.length; ...
  • Barcodes Encoding Decoding Java Example
    General Overview of BarCodes and using them to encode and decode BitMatrix bitMatrix = null;// initialize bitMatrix = new PDF417Writer()....
  • Count the PDF Pages using Java
    To get number of pages in the PDF import java.io.*; import com.lowagie.text.pdf.PdfReader; public class PDFSize { //static String P...
  • Ordering Rows of text file
    The two text files ,input file and template are read from the disk , Hash Maps / Array Lists are being extensively used to check and arrang...
  • Java Program to Print Number in the Given Data Type
    Here is Java Program to print number given in the data types public class second{ public static void main(String[] args){ int n; ...
  • Verifying in Runtime that dose the class exists within a program
    public class Main { public static boolean doesClassExist(String name) { try { Class c = Class.forName(name); i...
  • Hostname from IP Address
    The class instantiates an InetAddress object through the IP address provided as commandline argument and invokes the getHostName() through...
  • Sending mail through java API
    if the SMTP host is connecting, then only we can send the mails. And more over API jars are necessary public void sendEmailCommPaymentD...
  • Creating JSON data in Java
    JSON (JavaScript Object Notation) is a lightweight computer data interchange format. It is a text-based, human-readable format for represen...
Powered by Blogger.

Archives

  • ▼  2014 ( 4 )
    • ▼  August ( 4 )
      • Java program to create a Binary Heap and Perform v...
      • Create an Adjacency matrix Graph and perform Add a...
      • To Sort an Interger Array using Shell Sort
      • Sort an Integer array with Bucket Sort
  • ►  2013 ( 6 )
    • ►  August ( 1 )
    • ►  April ( 5 )
  • ►  2012 ( 673 )
    • ►  November ( 9 )
    • ►  October ( 223 )
    • ►  September ( 272 )
    • ►  August ( 2 )
    • ►  June ( 1 )
    • ►  February ( 67 )
    • ►  January ( 99 )
 

Our Blogs

  • Linux Tutorial
  • C Programming Tutorial

Labels

  • Agile Methodology ( 1 )
  • Algorithm ( 3 )
  • AntiSamy ( 1 )
  • Arithmetic Operation ( 1 )
  • Array Example ( 9 )
  • ArrayList Examples ( 11 )
  • Average an Array of Values ( 1 )
  • Barcode Example ( 1 )
  • Basic Java Programs ( 34 )
  • Bing API Example ( 2 )
  • BitSet Example ( 1 )
  • Boolean Example ( 1 )
  • Bouncy Castle API ( 1 )
  • Break Statement ( 2 )
  • BufferedReader Example ( 2 )
  • Calendar Example ( 1 )
  • Chart Generation Example ( 1 )
  • Command Line Argument ( 1 )
  • Comparator Example ( 1 )
  • Concatenation of String ( 1 )
  • Continue Statement ( 1 )
  • Control Structure ( 1 )
  • Copy File Example ( 1 )
  • CRC Example ( 1 )
  • CSV Example ( 6 )
  • Data Structure ( 5 )
  • Date Example ( 2 )
  • Directory Example ( 1 )
  • Do - While Loop Example ( 1 )
  • Domino Database ( 1 )
  • Email Example ( 8 )
  • Encryption Example ( 3 )
  • Excel Example ( 15 )
  • Factorial Example ( 1 )
  • File Upload Example ( 1 )
  • Find Roots of Quadratic Equation ( 1 )
  • FTP Example ( 2 )
  • Graph Examples ( 1 )
  • Greater between Two Numbers ( 1 )
  • GSON Library ( 1 )
  • HashMap Example ( 1 )
  • HashSet Example ( 1 )
  • Hello World Program ( 1 )
  • If Condition ( 2 )
  • Inner Class Example ( 1 )
  • iText Example ( 3 )
  • JAR File ( 1 )
  • JAVA Applet ( 1 )
  • Java Applications ( 1 )
  • Java AWT Example ( 9 )
  • Java Certification ( 1 )
  • Java Class Examples ( 15 )
  • Java Collection Example ( 1 )
  • Java Command Example ( 4 )
  • Java Constructor Examples ( 1 )
  • Java Currency Example ( 1 )
  • Java Database Example ( 3 )
  • Java Date and Time Example ( 3 )
  • Java DateFormat Example ( 3 )
  • Java Examples ( 2 )
  • Java Exception Example ( 5 )
  • Java File Example ( 22 )
  • Java GUI Example ( 1 )
  • Java Image Examle ( 3 )
  • Java Inheritance Example ( 3 )
  • Java Input Output Example ( 1 )
  • Java IO Example ( 3 )
  • Java Jar Example ( 1 )
  • Java JSON Example ( 3 )
  • Java Mail Examples ( 4 )
  • Java Map Example ( 5 )
  • Java MapReduce Example ( 2 )
  • Java MultiThreading Example ( 7 )
  • Java Network Example ( 9 )
  • Java Package ( 1 )
  • Java Programs ( 1 )
  • Java RMI ( 1 )
  • Java Robot Class Examples ( 2 )
  • Java Runtime Example ( 1 )
  • Java Swing Example ( 9 )
  • Java Util Example ( 1 )
  • Java Vector Example ( 4 )
  • Java Voice Example ( 1 )
  • Java Webservice Example ( 1 )
  • Java XML Example ( 3 )
  • Java Zip Class Examples ( 2 )
  • JDBC ( 9 )
  • JDK Version Comparison ( 1 )
  • JFrame Example ( 3 )
  • JOptionPane Dialog Example ( 1 )
  • JPanel Example ( 1 )
  • JSP Example ( 2 )
  • JSTL Example ( 1 )
  • jUnit Example ( 2 )
  • LinkedList Example ( 2 )
  • List Example ( 1 )
  • Long Variable ( 1 )
  • Lottery Nubmer ( 1 )
  • MD5 Hashing Example ( 3 )
  • Memory Management Example ( 1 )
  • Method Override ( 1 )
  • MIDI Sound ( 8 )
  • Module Operator Example ( 2 )
  • Multiplication Table ( 1 )
  • Observer Interface Example ( 1 )
  • Operator Example ( 5 )
  • Pagination ( 1 )
  • Palindrome Number ( 1 )
  • Pass By Reference Example ( 1 )
  • Pass By Value Example ( 1 )
  • PDF File Example ( 3 )
  • PDF Generation Example ( 4 )
  • Pre and Post Operator ( 2 )
  • Prime Number ( 3 )
  • Progress Bar Example ( 1 )
  • Property List Example ( 2 )
  • Random Function ( 7 )
  • Recursion Example ( 2 )
  • Regex Example ( 2 )
  • Remote Host Example ( 2 )
  • Robot Class ( 4 )
  • Searching Example ( 3 )
  • Slideshow ( 1 )
  • Sorting Example ( 7 )
  • SpringLayout Example ( 1 )
  • Stack Example ( 4 )
  • Static Variable ( 1 )
  • StreamTokenizer Example ( 2 )
  • String Example ( 19 )
  • Struts2 Example ( 1 )
  • Sum of Digits ( 1 )
  • Swap Two Numbers ( 1 )
  • Switch Case ( 3 )
  • Tapestry Components ( 1 )
  • Thumbnail Example ( 2 )
  • TimerTask Example ( 2 )
  • To Calculate Volume ( 1 )
  • To Check Armstrong Number ( 1 )
  • Tree Example ( 1 )
  • TreeMap Example ( 1 )
  • TreeSet Example ( 1 )
  • Two Dimensional Array Example ( 1 )
  • UUID ( 1 )
  • Validation Example ( 2 )
  • Variable Casting ( 1 )
  • While Loop ( 1 )
  • XML Parsing ( 7 )
  • XSS Attacks ( 1 )
  • Zip File ( 15 )

Popular Posts

  • Creating Dynamic Macro Enabled Excel by Java
    We can create a dynamic macro enabled excel by java: We need to create a excel sheet template with macro on server. we can copy the...
  • Java program to create a Binary Heap and Perform various operation
    A binary heap (min-heap) is a complete binary tree with elements from a partially ordered set, such that the element at every node is less ...
  • To Sort an Interger Array using Shell Sort
    To Sort an Interger Array using Shell Sort class ShellSort { public static int[] shellSort(int[] array) { int N = array.length; ...
  • Implementation of a basic generic tree, with labels of type T - Data Structure
    // This implements a basic generic tree, with labels of type T, // pointer to the parent node, and a singly linked list of children nodes...
  • Create an Adjacency matrix Graph and perform Add and Remove operation
    import java.util.ArrayList; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; import...
  • Printing Table In java using While Loop
    Here is a Java Program to Print the Table public class Table { public static void main(String[] args) { int no = Integer.p...
  • Merge-Sort Algorithm implementation in JAVA
    Merge-Sort Function void MergeSort(int low, int high) // a[low : high] is a global array to be sorted. // Small(P) is true if there...
  • Sort an Integer array with Bucket Sort
    Here is a java program to Sort an Integer array with Bucket Sort class BucketSort { public int[] bucketSort(int[] array) { /...
  • Stack implemented as array - Data Structure
    // Stack implemented as array public class ArrayStack<T> { private T[] stack; private int numElements = 0; // points to s...
  • Java Program to Generate the Lottery Number between 1 to 49
     A lottery requires that you select six different numbers from the integers 1 to 49. Write a program to do this for you and generate five s...
 
 
© 2011 Java Programs and Examples with Output | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger