It's simple, just do the power calculation and then add 1.
As no more details follow below. The code calculates all powers of 2 and powers of 2 with 1.
Scanner input = new Scanner(System.in);
System.out.print("Digite um número: ");
int numeroEscolhido = input.nextInt(); //número digitado pelo usuário
for(int i = 0; i <= numeroEscolhido; i++){
int potenciaDe2 = (int)Math.pow(2, i);
int potenciaDe2Mais1 = (int)Math.pow(2, i) + 1;
System.out.println(String.format("(2^%s): %s | (2^%s)+1: %s", i, potenciaDe2, i, potenciaDe2Mais1));
}
Entering the number 5 , the output will be:
(2^0): 1 | (2^0)+1: 2
(2^1): 2 | (2^1)+1: 3
(2^2): 4 | (2^2)+1: 5
(2^3): 8 | (2^3)+1: 9
(2^4): 16 | (2^4)+1: 17
(2^5): 32 | (2^5)+1: 33
See working on repl.it.