Monthly Archives: January 2018

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