Uday's Tech Space


Showing Tag: "java" (Show all posts)

Merge Sort - Revisit with Fork and Join

Posted by Uday Shankar on Monday, February 23, 2015, In : Java 
Linear merge sort:

    private int[] mergeSort(int[] input, int fromIndex, int length) {
        if (length == 1)
            return new int[]{input[fromIndex]};
        int mid = length >>> 1;
        int[] sorted1 = mergeSort(input, fromIndex, mid);
        int[] sorted2 = mergeSort(input, (fromIndex + mid), (length - mid));
        return merge(sorted1, sorted2);
    }

    private int[] merge(int[] sorted1, int[] sorted2) {
        int[] merged = new int[sorted1.length + sorted2.length];
        int ...

Continue reading ...
 

Counting Classes and Methods in a package

Posted by Uday Shankar on Friday, October 3, 2014, In : Java 
This is just a utility i created joining these blog posts:

How can I count the number of methods in a Java class ?
and 
Get All Classes Within A Package

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;

/**
 * Counts the number of classes and methods in a package.
 */
public class CountPackageMethods {
    /**
     * Scans all classes accessible from the context class loader w...

Continue reading ...
 

XML vs. JSON vs. Protocol Buffer : A Comparative Study

Posted by Uday Shankar on Friday, September 5, 2014, In : Design 
XML
Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.

XML Structure
XML Declaration
XML documents may begin by declaring some information about themselves, as in the following example:
<?xml version="1.0" encoding="UTF-8" ?> 
Tag
A markup construct that begins with < and ends with >. Tags come in three flavors: 
start-tags; for example: <section>
end-tags; for example: </section>
empty-...

Continue reading ...
 

Interview Preperations

Posted by Uday Shankar on Tuesday, August 7, 2012, In : interview 
Collectable links ...

How Hashmap Works

GOF Design patterns Examples



Continue reading ...
 

XML Properties

Posted by Uday Shankar on Friday, March 19, 2010, In : Java 
While building one of the java projects i came across properties files. They are kind of configuration files which are easy to use in java as java provide its apis. But with time i found that properties files are limited in a way like it does not have properties of a property or it could not have two or more values for the same property. For quite some time i was looking for a solution but it seems it is a less traveled path. Hence i had tried to develop something similar to properties api bu...
Continue reading ...
 
 

About Me


Uday Shankar A curious Java Developer.
Make a Free Website with Yola.