Generating all possible combinations of a string using iteration I am generating all possible combinations from a string concatenated. I have a \$O(n*2^n)\$ solution. 

public static String[] combinations(String[] array) {
    String[] res = new String[(1 &lt;&lt; array.length) - 1];
    int k = 0;
    int x = 1;
    for (int i = array.length - 1; i &gt;= 0; --i) {
        res[k++] = array[i];
        for (int j = 1; j &lt; x; ++j) {
            res[k++] = array[i] + res[j - 1];
        }
        x *= 2;
    }
    return res;
}


How can this be improved?
Minor changes

As @coderodde already stated, there is not much to improve, nonetheless a few minor things:

You can reduce the scope of the variables x (which has always the same value as k prior entering the inner loop) and k to the inner/outer loop.
for (int i = array.length - 1; i &gt;= 0; --i) can be written as for (int i = array.length; --i &gt;= 0;).
Your inner loop starts at j = 1 but only uses j - 1, you can start the loop at 0 to avoid the subtraction.

Depending on how nulls should be handled, you could use res[k++] = array[i].toString() to throw a NPE if null elements are present. If nulls are permitted, I would prefer that the string "null" is added to the resulting array rather than a null reference.

You could start k and j at -1 and use the (in theory) more efficient preincrement operator instead of the postincrement operator.

Possible implementation (not using preincrement for kand j as I think it makes the code more difficult to read):

public static String[] combinations(String[] array) {
    String[] res = new String[-1 &gt;&gt;&gt; -array.length];
    for (int i = array.length, k = 0; --i &gt;= 0;) {
        String s = res[k] = array[i].toString();
        for (int j = 0, x = k++; j &lt; x;)
            res[k++] = s + res[j++];
    }
    return res;
}


Alternative implementation

Your current implementation supports arrays with a maximum length of 30, you could provide a method #combination(String[] array, long index) to support arrays with up to 64 elements (or a larger datatype than long to support way larger input arrays).

public static String combination(String[] array, long index) {
    // Could iterate twice to determine length (and coder) first
    // to avoid resizing buffer (and could share the resulting
    // byte array), kept this way for simplicity.
    if (array.length &gt; 64 || index == -1 || index + 1 &gt;&gt;&gt; array.length != 0)
        throw new IllegalArgumentException();
    index = index + 1 &lt;&lt; -array.length;
    StringBuilder sb = new StringBuilder();
    for (int i = -1; index != 0;) {
        int nlz = numberOfLeadingZeros(index);
        sb.append(array[i += nlz + 1]);
        index = index &lt;&lt; nlz &lt;&lt; 1;
    }
    return sb.toString();
}