private int getDecimalValueFromBinary(String binary)
    {
        int value = 0;
        int length = binary.length();
        int idx = length;
        for (int i = 0; i < length; i++) {
            idx--;
            value += Integer.parseInt(binary.substring(idx, idx + 1)) * Math.pow(2, i);
        }
        return value;
    }