Author Archives: ashokabhat

About ashokabhat

I am a C,C ,JAVA,Adobe Flex,.NET Programmer Currently working as a Software Developer

Lift Operation – Program Development in Java Interesting !!!

import java.awt.geom.*; public class elevator { static int floor; public static void main(String args[]) { floor = (int) (Math.random() * 10 + 1); System.out.println(“The elevator is now on floor ” +floor); System.out.print(“Which floor are you at now (0-10) where 0 … Continue reading

Rate this:

| Leave a comment

Matrix Graph Implementation in Java

public class MatrixGraphs { public static void main(String args[]) { AdjacencyMatrixGraph graph = new AdjacencyMatrixGraph(10); graph.addEdge(1, 2); graph.addEdge(1, 5); graph.addEdge(2, 5); graph.addEdge(1, 2); graph.addEdge(2, 3); graph.addEdge(3, 4); graph.addEdge(4, 1); graph.addEdge(2, 3); System.out.println(graph); } } class AdjacencyMatrixGraph { private int _numberOfVertices; … Continue reading

Rate this:

| Leave a comment

HashMap Implementation in Java Easy…

import java.util.ArrayList; import java.util.LinkedList; public class HashMap<K,V> { public class hmnodes{ //HashMap nodes K key; V value; } private int size=0; //size of hashmap private LinkedList<hmnodes> buckets[]; //array of addresses of list public HashMap(){ buckets=new LinkedList[4]; //initially create bucket of … Continue reading

Rate this:

| Leave a comment

Unzip Utility in Java

public class UnzipUtility { /* Automaticaly UnCompress Tar files * @author Ashoka BM * */ public static List unTar(File tarFile, File directory) throws IOException { List<String> result = new ArrayList<String>(); InputStream inputStream = new FileInputStream(tarFile); TarArchiveInputStream in = new TarArchiveInputStream(inputStream); … Continue reading

Rate this:

| Leave a comment

Check the Operating System – Java Utility

public class SystemUtility { private static String OS = System.getProperty(“os.name”).toLowerCase(); /** * If System is Windows OS * @return */ public static boolean isWindows() { return (OS.indexOf(“win”) >= 0); } /** * If System OS is Mac * @return */ … Continue reading

Rate this:

| Leave a comment

Compare two table columns attributes data – Using SQL Queries

/** * Create Source table for Compare CSV Files Data * @param filePath * @param conn * @param chunkId * @param subsetId * @throws Exception */ public void getFileContentSRC(String filePath,Connection conn,String chunkId,String subsetId) throws Exception { String sql=””; CSVParser parser … Continue reading

Rate this:

| Leave a comment

Get the common files names in 2 different directories – Java Utility

/** * This will return common file names from the List * @param localListOfFiles * @param sdpListOfFiles * @return */ public static List getCommonFileNames(File[] localListOfFiles,File[] sdpListOfFiles) { List<String> commonFiles=new ArrayList<String>(); for (int j = 0; j < localListOfFiles.length; j++) { … Continue reading

Rate this:

| Leave a comment