Blog Archives

Parse XML using SAX in Java

XML stands for eXtended Markup Language. SAX (Simple API for XML) is an event-based sequential access parser API for XML documents. SAX is an alternative to the DOM parser. The DOM parser operates on the document as a whole, whereas

Tagged with: , ,
Posted in Java

Print All Permutations of Sets

A permutation of a set is an arrangement of the elements in a particular order. For example, there are two permutations of {1,2}, namely {1,2} and {2,1}, and 6 permutations of {1,2,3}, namely {1,2,3}, {1,3,2}, {2,1,3}, {2,3,1}, {3,1,2}, and {3,2,1}.

Tagged with: ,
Posted in Algorithm, Java

Array Circular Shift

The problem is to rotate elements in an array in a circular way. For example, shifting the array {38, 27, 43, 3, 9, 82, 10} 3 positions to the left produces {3, 9, 82, 10, 38, 27, 43} Using a

Tagged with:
Posted in Algorithm, Java

Parse JSON in Java

JSON stands for JavaScript Object Notation, and it is based on a subset of JavaScript. As a data-exchange format, it is widely used in web programming. Here we show how to parse JSON data in Java using the org.json library.

Tagged with: ,
Posted in Java