Showing posts with label Sorting. Show all posts
Showing posts with label Sorting. Show all posts

Sunday, December 8, 2019

How do you sort collection of StringBuffer object in java?

Problem statement: Given the collection of StringBuffer objects.
StringBuffer sb1 = new StringBuffer("Z");
StringBuffer sb2 = new StringBuffer("A");
StringBuffer sb3 = new StringBuffer("P");

You have to sort it either way, meaning natural order or custom order.

Answer:
// ASCENDING ORDER:
  1. import java.util.Comparator;
  2. import java.util.TreeSet;
  3. public class Test {
  4. public static void main(String[] args) {
  5. SortStringBufferObject s = new SortStringBufferObject();
  6. TreeSet<StringBuffer> t = new TreeSet<>(s);
  7. t.add(new StringBuffer("Z"));
  8. t.add(new StringBuffer("A"));
  9. t.add(new StringBuffer("P"));
  10. System.out.println(t);
  11. }
  12. }
  13. class SortStringBufferObject implements Comparator<StringBuffer> {
  14. public int compare(StringBuffer sb1, StringBuffer sb2) {
  15. return sb1.toString().compareTo(sb2.toString());
  16. }
  17. }
Output:
[A, P, Z] 

// DESCENDING ORDER:
  1. import java.util.Comparator;
  2. import java.util.TreeSet;
  3. public class Test {
  4. public static void main(String[] args) {
  5. SortStringBufferObject s = new SortStringBufferObject();
  6. TreeSet<StringBuffer> t = new TreeSet<>(s);
  7. t.add(new StringBuffer("Z"));
  8. t.add(new StringBuffer("A"));
  9. t.add(new StringBuffer("P"));
  10. System.out.println(t);
  11. }
  12. }
  13. class SortStringBufferObject implements Comparator<StringBuffer> {
  14. public int compare(StringBuffer sb1, StringBuffer sb2) {
  15. return sb2.toString().compareTo(sb1.toString());
  16. }
  17. }
Output:
[Z, P, A]
Reference

Monday, August 26, 2019

How do you sort the keys in HashMap?

Problem statement:
Write the java code to sort the keys in HashMap.

  1. import java.util.HashMap;
  2. import java.util.Set;
  3. import java.util.TreeSet;
  4. public class Test {
  5. public static void main(String[] args) {
  6. HashMap<String, String> m = new HashMap<String, String>();
  7. m.put("key45", "aa");
  8. m.put("key12", "zz");
  9. m.put("key39", "cc");
  10. m.put("key27", "bb");
  11. Set<String> s = m.keySet();
  12. s = new TreeSet<String>(s);
  13. System.out.println(s);
  14. }
  15. }
Output:
[key12, key27, key39, key45]

How do you sort the values in HashMap?

Problem statement:
Write the java code to sort the values in HashMap.
  1. import java.util.Collection;
  2. import java.util.HashMap;
  3. import java.util.TreeSet;
  4. public class Test {
  5. public static void main(String[] args) {
  6. HashMap<String, String> m = new HashMap<String, String>();
  7. m.put("key45", "aa");
  8. m.put("key12", "zz");
  9. m.put("key39", "cc");
  10. m.put("key27", "bb");
  11. Collection<String> c = m.values();
  12. c = new TreeSet<String>(c);
  13. System.out.println(c);
  14. }
  15. }
Output:
[aa, bb, cc, zz]

Which of the following option will sort the keys in HashMap ?

Problem statement:
Given java code as follows, can you find out the correct option to sort the keys in HashMap?
  1. import java.util.HashMap;
  2. import java.util.Set;
  3. import java.util.TreeSet;
  4. public class Test {
  5. public static void main(String[] args) {
  6. HashMap<String, String> m = new HashMap<String, String>();
  7. m.put("key45", "aa");
  8. m.put("key12", "bb");
  9. m.put("key39", "cc");
  10. Set<String> s = m.keySet();
  11.   // code goes here
  12. s = new TreeSet(s);
  13.  }
  14. }
  • Arrays.sort(s);
  • s = new TreeSet(s);
  • Collections.sort(s);
  • s = new SortedSet(s);
Correct option: 
s = new TreeSet(s);
Explanation:
Arrays.sort(s) // sorts for static array 
Collection.sort(s) // sort the List type of object not Set type
s =new SortedSet(s); // SortedSet is an interface

Monday, May 20, 2019

Can you write an algorithm to print the following pattern?

Problem statement:
Given an input string from the console as follows

Sample I/O:

aaaaa, bbbb, cccc, d , f , g , i
Sample O/P:
a5, b4, c4,d1, f1, h1, g1, i1
  1. import java.util.Scanner;
  2. public class SwitchStatement {
  3.     public static void main(String[] args) {
  4.         Scanner sc = new Scanner(System.in);
  5.         System.out.println("Enter the pattern.");
  6.         String pattern = sc.nextLine();
  7.         System.out.println(pattern.charAt(0) + "" + pattern.length());
  8.     }
  9. }

Sunday, May 19, 2019

How do you sort an array based on count of occurrences in descending order


How do you sort an array based on count of occurrences in ascending order

Problem statement:
Given an array of integer, you have to sort based on count of occurrences in ascending order?
  1. import java.util.*;
  2. public class SortArrayInDesc {
  3.     public static void main(String[] args) {
  4.         int a[] = {2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 1, 1, 1};
  5.         HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
  6.         for (int i = 0; i < a.length; i++) {
  7.             if (map.containsKey(a[i])) {
  8.               map.put(a[i], map.get(a[i]) + 1);
  9.             } else {
  10.                 map.put(a[i], 1);
  11.             }
  12.         }
  13.         ValueComparator<Integer, Integer> comparator = new ValueComparator<Integer, Integer>(map);
  14.         TreeMap<Integer, Integer> sortedMap = new TreeMap<Integer, Integer>(comparator);
  15.         sortedMap.putAll(map);
  16.         ArrayList<Integer> lists = new ArrayList<Integer>();
  17.         for (Integer i : sortedMap.keySet()) {
  18.             for (int c = 0; c < sortedMap.get(i); c++) {
  19.                 lists.add(i);
  20.             }
  21.         }
  22.         System.out.println(lists.toString());
  23.     }
  24. }
  1. import java.util.Comparator;
  2. import java.util.Map;
  3. public class ValueComparator<T1, T2 extends Comparable<T2>> implements Comparator<T1> {
  4.     Map<T1, T2> map;
  5.     public ValueComparator(Map<T1, T2> map) {
  6.         this.map = map;
  7.     }
  8.     @Override
  9.     public int compare(T1 k1, T1 k2) {
  10.         T2 val1 = map.get(k1);
  11.         T2 val2 = map.get(k2);

  12.         return val1.compareTo(val2);
  13.     }
  14. }
Output:
[5, 1, 1, 1, 2, 2, 2, 2, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4]

Friday, May 10, 2019

How to sort keys in TreeMap by using Comparator with user define objects?

Problem statement:
How to sort keys in TreeMap by using Comparator with user defined objects.
  1. import java.util.Comparator;
  2. import java.util.Set;
  3. import java.util.TreeMap;
  4. public class SortByKeyUserDefine {
  5.     public static void main(String a[]) {
  6.         //By using name comparator (String comparison)
  7.         System.out.println("========= Sort by name ==============");
  8.         TreeMap<Employee, String> tm = new TreeMap<Employee, String>(new MyNameComp());
  9.         tm.put(new Employee("Ram", 3000), "RAM");
  10.         tm.put(new Employee("John", 6000), "JOHN");
  11.         tm.put(new Employee("Crish", 2000), "CRISH");
  12.         tm.put(new Employee("Tom", 2400), "TOM");
  13.         Set<Employee> keys = tm.keySet();
  14.         for (Employee key : keys) {
  15.             System.out.println(key + " ==> " + tm.get(key));
  16.         }
  17.         System.out.println("========= Sort by salary ==============");
  18.         //By using salary comparator (int comparison)
  19.         TreeMap<Employee, String> trmap = new TreeMap<Employee, String>(new MySalaryComp());
  20.         trmap.put(new Employee("Ram", 3000), "RAM");
  21.         trmap.put(new Employee("John", 6000), "JOHN");
  22.         trmap.put(new Employee("Crish", 2000), "CRISH");
  23.         trmap.put(new Employee("Tom", 2400), "TOM");
  24.         Set<Employee> ks = trmap.keySet();
  25.         for (Employee key : ks) {
  26.             System.out.println(key + " ==> " + trmap.get(key));
  27.         }
  28.     }
  29. }

  30. class MyNameComp implements Comparator<Employee> {
  31.     @Override
  32.     public int compare(Employee e1, Employee e2) {
  33.         return e1.getName().compareTo(e2.getName());
  34.     }
  35. }

  36. class MySalaryComp implements Comparator<Employee> {
  37.     @Override
  38.     public int compare(Employee e1, Employee e2) {
  39.         if (e1.getSalary() > e2.getSalary()) {
  40.             return 1;
  41.         } else {
  42.             return -1;
  43.         }
  44.     }
  45. }

  46. class Employee {
  47.     private String name;
  48.     private int salary;
  49.     public Employee(String n, int s) {
  50.         this.name = n;
  51.         this.salary = s;
  52.     }
  53.     public String getName() {
  54.         return name;
  55.     }
  56.     public void setName(String name) {
  57.         this.name = name;
  58.     }
  59.     public int getSalary() {
  60.         return salary;
  61.     }
  62.     public void setSalary(int salary) {
  63.         this.salary = salary;
  64.     }
  65.     public String toString() {
  66.         return "Name: " + this.name + " , Salary: " + this.salary;
  67.     }
  68. }
Output:
========= Sort by name ==============
Name: Crish , Salary: 2000 ==> CRISH
Name: John , Salary: 6000 ==> JOHN
Name: Ram , Salary: 3000 ==> RAM
Name: Tom , Salary: 2400 ==> TOM
========= Sort by salary ==============
Name: Crish , Salary: 2000 ==> null
Name: Tom , Salary: 2400 ==> null
Name: Ram , Salary: 3000 ==> null
Name: John , Salary: 6000 ==> null

How do you sort alphanumeric key of a map OR Sort map by key in java?

Problem statement:
How do you sort alphanumeric key of a map ?

  1. import java.util.HashMap;
  2. import java.util.Map;
  3. import java.util.Set;
  4. import java.util.TreeMap;
  5. public class SortAlphanumericKeyInMap {
  6.     public static void main(String[] args) {
  7.         Map<String, String> map = new HashMap<>();
  8.         map.put("A1BB", "1");
  9.         map.put("A2CC", "2");
  10.         map.put("A2AA", "2");
  11.         map.put("B1AA", "7");
  12.         Map<String, String> treeMap = new TreeMap<>(map);
  13.         Set<String> keys = treeMap.keySet();
  14.         for (String key : keys) {
  15.             System.out.println(key);
  16.         }
  17.     }
  18. }
Output:
A1BB
A2AA

A2CC
B1AA

How do you sort alphanumeric key of a map OR Sort map by key in java?

Problem statement:
How do you sort alphanumeric key of a map ?
Method-I:
  1. import java.util.HashMap;
  2. import java.util.Map;
  3. import java.util.Set;
  4. import java.util.TreeMap;
  5. public class SortAlphanumericKeyInMap {
  6.     public static void main(String[] args) {
  7.         Map<String, String> map = new HashMap<>();
  8.         map.put("question1", "1");
  9.         map.put("question9", "2");
  10.         map.put("question4", "2");
  11.         map.put("question6", "7");
  12.         // using TreeMap
  13.         Map<String, String> treeMap = new TreeMap<>(map);
  14.         Set<String> keys = treeMap.keySet();
  15.         for (String key : keys) {
  16.             System.out.println(key);
  17.         }
  18.     }
  19. }
Output:
question1
question4
question6
question9

Method-II:
import java.util.*;
public class SortAlphanumericKeyInMap {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("question1", "1");
        map.put("question9", "2");
        map.put("question4", "2");
        map.put("question6", "7");
        Set<String> set = map.keySet();
        // This will iterate across the map in natural order of the keys.
        SortedSet<String> keys = new TreeSet<>(set);
        for (String key : keys) {
            System.out.println("sorted key: " + key + " | values: " + map.get(key));
        }
    }
}
Output:
sorted key: question1 | values: 1
sorted key: question4 | values: 2
sorted key: question6 | values: 7
sorted key: question9 | values: 2

Method-III:

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Collections;
public class SortAlphanumericKeyInMap {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("question1", "1");
        map.put("question9", "2");
        map.put("question4", "2");
        map.put("question6", "7");
        Set set = map.keySet();
        // using List
        List keys = new ArrayList(set);
        Collections.sort(keys);
        for (Object key : keys) {
            System.out.println(key);
        }
    }
}
Output:
question1
question4
question6
question9

Thursday, May 31, 2018

Binary search program in java.

Problem statement: What & how do you do binary search ?
  1. A simple approach is to do linear search.
  2. The time complexity of this approach's algorithm is O(n). 
  3. Another approach to perform the same task is using Binary SearchIn case of binary search, array elements must be sorted in ASCENDING order, not in DESCENDING order
  4. The idea of binary search is to use the information that the array is sorted and reduce the time complexity to O(Log n).
  5. Binary search is faster than linear search.
  • Algorithm:
  1. Search a sorted array by repeatedly dividing the search interval in half. 
  2. Begin with an interval covering the whole array. 
  3. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. 
  4. Otherwise narrow it to the upper half. 
  5. Repeatedly check until the value is found or the interval is empty.
N.B. - In case of binary search, array elements must be in ascending order. If you have UNSORTED array, you can sort the array using Arrays.sort(arr) method.

METHOD-I:

  1. public class BinarySearchExe {
  2. public static void main(String args[]) {
  3. int arr[] = { 10, 20, 30, 40, 50 };
  4. binarySearchss(arr, 30);
  5. }
  6. public static void binarySearchss(int a[], int key) {
  7. int start = 0, end = a.length - 1;
  8. int mid = (start + end) / 2;
  9. while (start <= end) {
  10. if (key == a[mid]) {
  11. System.out.println("key at index: " + mid);
  12. break;
  13. } else if (key > a[mid]) {
  14. start = mid + 1;
  15. } else {
  16. end = mid - 1;
  17. }
  18. mid = (start + end) / 2;
  19. }
  20. if (start > end) {
  21. System.out.println("key not found!");
  22. }
  23. }
  24. }
Output: 
key at index: 2
Time complexity: O(log n)

METHOD-II:
  1. public class BinarySearchExe {
  2. public static void main(String[] args) {
  3. int a[] = { 10, 20, 30, 40, 50 };
  4. int idx = binarySearch(a, 30);
  5. System.out.println("key at index: " + idx);
  6. }
  7. public static int binarySearch(int a[], int key) {
  8. int start = 0, end = a.length - 1;
  9. while (start <= end) {
  10. int mid = (start + end) / 2;
  11. if (key == a[mid]) {
  12. return mid;
  13. }
  14. if (key < a[mid]) {
  15. end = mid - 1;
  16. } else {
  17. start = mid + 1;
  18. }
  19. }
  20. return -1;
  21. }
  22. }
Output: 
key at index: 2
Time complexity: O(log n)

Thursday, May 17, 2018

Sort employee object based on name

Problem statement: Sort employee object based on name !

  1. import java.util.ArrayList;
  2. import java.util.Collections;
  3. import java.util.Comparator;
  4. import java.util.List;

  5. class Employee {
  6. Integer id;
  7. String name;

  8. Employee(int id, String name) {
  9. this.id = id;
  10. this.name = name;
  11. }

  12. public String toString() {
  13. return "id: " + id + " -name: " + name;
  14. }
  15. }

  16. class SortByEmpName implements Comparator<Employee> {
  17. public int compare(Employee e1, Employee e2) {
  18. return e1.name.compareTo(e2.name);
  19. }
  20. }

  21. public class SortEmployee {

  22. public static void main(String[] args) {
  23. List<Employee> lists = new ArrayList<Employee>();
  24. lists.add(new Employee(23, "ishaan"));
  25. lists.add(new Employee(34, "raju"));
  26. lists.add(new Employee(2, "zebra"));
  27. lists.add(new Employee(43, "ch"));

  28. Collections.sort(lists, new SortByEmpName());
  29. for (Object o : lists) {

  30. System.out.println(o);
  31. }
  32. }
  33. }
Output:

id: 43 -name: ch
id: 23 -name: ishaan
id: 34 -name: raju
id: 2 -name: zebra

Sort employee object base on salary & location both

Problem statement: Sort employee record based on salary & location.

  1. import java.util.List;
  2. import java.util.Arrays;
  3. import java.util.ArrayList;
  4. import java.util.Collections;
  5. import java.util.Comparator;

  6. class EmployeeExe1 {
  7. String name;
  8. Double salary;
  9. String location;
  10. EmployeeExe1(String name, Double salary, String location) {
  11. this.name = name;
  12. this.salary = salary;
  13. this.location = location;
  14. }
  15. public String toString() {
  16. return "name: " + name + ", salary: " + salary + ", location: " + location;
  17. }
  18. }

  19. class SortEmpBySalary implements Comparator<EmployeeExe1> {
  20. public int compare(EmployeeExe1 e1, EmployeeExe1 e2) {
  21. if (e1.salary.compareTo(e2.salary) > 0) {
  22. return 1;
  23. }
  24. if (e1.salary.compareTo(e2.salary) < 0) {
  25. return -1;
  26. }
  27. return 0;
  28. }
  29. }

  30. class SortEmpByLocation implements Comparator<EmployeeExe1> {
  31. public int compare(EmployeeExe1 e1, EmployeeExe1 e2) {
  32. return e1.location.compareTo(e2.location);
  33. }
  34. }

  35. class SortByTwoFields implements Comparator<EmployeeExe1> {
  36. List<Comparator<EmployeeExe1>> empAll;

  37. @SafeVarargs
  38. public SortByTwoFields(Comparator<EmployeeExe1>... e2) {
  39. this.empAll = Arrays.asList(e2);
  40. }

  41. @Override
  42. public int compare(EmployeeExe1 o1, EmployeeExe1 o2) {
  43. for (Comparator<EmployeeExe1> x : empAll) {
  44. int res = x.compare(o1, o2);
  45. if (res != 0) {
  46. return res;
  47. }
  48. }
  49. return 0;
  50. }
  51. }

  52. public class SortEmplyeeBySalLoc {
  53. public static void main(String[] args) {
  54. List<EmployeeExe1> l = new ArrayList<EmployeeExe1>();
  55. l.add(new EmployeeExe1("ishaan", 12000.00, "blr"));
  56. l.add(new EmployeeExe1("raju", 11000.00, "hyd"));
  57. l.add(new EmployeeExe1("ritesh", 9000.00, "del"));
  58. l.add(new EmployeeExe1("nikash", 9000.00, "mum"));

  59. Collections.sort(l, new SortByTwoFields(new SortEmpBySalary(), new SortEmpByLocation()));
  60. for (Object o : l) {
  61. System.out.println(o);
  62. }
  63. }
  64. }
Output:

name: ritesh, salary: 9000.0, location: del
name: nikash, salary: 9000.0, location: mum
name: raju, salary: 11000.0, location: hyd
name: ishaan, salary: 12000.0, location: blr

Saturday, April 28, 2018

Sort a HashMap by key !!

Sorting a HashMap by key in Java:

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class SortMapByKey {
public static void main(String[] args) {
Map<String, Integer> map = new HashMap<String, Integer>();
map.put("z", 1);
map.put("q", 2);
map.put("p", 3);
map.put("s", 4);
map.put("o", 5);
System.out.println(map);
Set<Entry<String, Integer>> entrySet = map.entrySet();
List<Entry<String, Integer>> lists = new ArrayList<Entry<String, Integer>>(entrySet);

Collections.sort(lists, new Comparator<Entry<String, Integer>>() {
@Override
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
return (o1.getKey()).compareTo(o2.getKey());
}
});
System.out.println("--------------------");
for (Map.Entry<String, Integer> entry : lists) {
System.out.println(entry.getKey() + " :: " + entry.getValue());
}
}
}

Output: 
{p=3, q=2, s=4, z=1, o=5}
--------------------
o :: 5
p :: 3
q :: 2
s :: 4
z :: 1

Friday, April 27, 2018

Java sort single field using Comparator.


import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

class SortBySalary implements Comparator<Human> {
@Override
public int compare(Human o1, Human o2) {
if (o1.salary > o2.salary)
return 1;
if (o1.salary < o2.salary)
return -1;
return 0;
}

}

class Human {
String name;
int age;
double salary;

public Human(String n, int a, double s) {
this.name = n;
this.age = a;
this.salary = s;
}

public Human() {
}

public String toString() {
return this.name + " " + this.age + " " + this.salary;
}

}

public class ComparatorExe {
public static void main(String[] args) {

List<Human> l = new ArrayList();
Human h1 = new Human("ritesh", 12, 6000);
Human h2 = new Human("raju", 18, 5000);
Human h3 = new Human("ishaan", 10, 7000);
Human h4 = new Human("yuyu", 15, 333);
Human h5 = new Human("yuyu", 17, 333);
Human h6 = new Human("yuyu", 13, 333);
l.add(h1);
l.add(h2);
l.add(h3);
l.add(h4);
l.add(h5);
l.add(h6);

System.out.println(l);

Collections.sort(l, new SortBySalary());
System.out.println(l);
}

}


Output:
[ritesh 12 6000.0, raju 18 5000.0, ishaan 10 7000.0, yuyu 15 333.0, yuyu 17 333.0, yuyu 13 333.0]
[yuyu 15 333.0, yuyu 17 333.0, yuyu 13 333.0, raju 18 5000.0, ritesh 12 6000.0, ishaan 10 7000.0]

Java sort multiple fields using Comparator.

Sort multiple fields using Comparator:

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

class SortByAnimalName implements Comparator<Animal> {

@Override
public int compare(Animal o1, Animal o2) {
return o1.name.compareTo(o2.name);
}
}

class SortByAnimalColor implements Comparator<Animal> {

@Override
public int compare(Animal o1, Animal o2) {
return o1.color.compareTo(o2.color);
}
}

class SortByAnimalWeight implements Comparator<Animal> {

@Override
public int compare(Animal o1, Animal o2) {
if (o1.weight > o2.weight) {
return 1;
}
if (o1.weight < o2.weight) {
return -1;
}
return 0;
}
}

class SortByAllAnimal implements Comparator<Animal> {

List<Comparator<Animal>> allFields;

@SafeVarargs
SortByAllAnimal(Comparator<Animal>... allSort) {
this.allFields = Arrays.asList(allSort);

}
@Override
public int compare(Animal o1, Animal o2) {
for (Comparator<Animal> x : allFields) {
int res = x.compare(o1, o2);
if (res != 0) {
return res;
}
}
return 0;
}
}

class Animal {
String color;
String name;
int weight;

Animal(String c, String n, int w) {
this.color = c;
this.name = n;
this.weight = w;
}
@Override
public String toString() {
return this.color + " " + this.name + " " + this.weight;
}
}

public class SortMultipleDataByComparator{
public static void main(String[] args) {
List<Animal> l = new ArrayList<Animal>();
Animal a1 = new Animal("black", "dog", 20);
Animal a2 = new Animal("white", "cat", 15);
Animal a3 = new Animal("black", "elephant", 120);
Animal a4 = new Animal("white", "horse", 80);
l.add(a1);
l.add(a2);
l.add(a3);
l.add(a4);
System.out.println(l);
System.out.println("------------------------------------");
Collections.sort(l,
new SortByAllAnimal(new SortByAnimalColor(), new SortByAnimalName(), new SortByAnimalWeight()));

System.out.println(l);
}
}


Output:

[black dog 20, white cat 15, black elephant 120, white horse 80]
------------------------------------
[black dog 20, black elephant 120, white cat 15, white horse 80]

How to run standalone mock server on local laptop

 Please download the standalone wiremock server from Direct download section at the bottom of the page.  Download and installation Feel fre...