Question: Write a JAVA method with the following header: public static void numbers(String prefix, int n) The number n is non-negative. The argument called prefix is
Write a JAVA method with the following header:
public static void numbers(String prefix, int n)
The number n is non-negative. The argument called prefix is String of 0s and 1s. The method prints a sequence of binary numbers. Each output number consists of the prefix followed by a suffix of exactly n more binary digits(0s and 1s). All possible combinations of the prefix and the same n-digit suffix are printed. As an example, if the prefix string is "00101" and the n is 2, then the method would print the prefix followed by the 4 possible suffixes as shown here :
0010100
0010101
0010110
0010111
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
