Help me in solving LBJ19 problem

My issue

My code

// Update the code below to solve this problem
import java.util.Scanner;

class Codechef
{
	public static void main (String[] args)
	{
		Scanner read = new Scanner(System.in);
		
		int t = read.nextInt();
		for(int i=0; i<t; i++)
		{
    		int N = read.nextInt();
    		int X = read.nextInt();
    		int totalSpent = 0;
            int amountRemaining = 2 ^ X;

            for (int j = 1; j <= N; j++) {
                int spentI = (int) (0.5 * amountRemaining);
                amountRemaining -= spentI;
                totalSpent += spentI;
            }

            int amountSaved = 2 ^ X - totalSpent;
            System.out.println(amountSaved);
		}
	}
}

Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone

Can anyone fix the error…

@sahil_2701
u can’t calculate 2^x like this

I didn’t understand bro??

@sahil_2701
like if u want to calculate 2 to the power x then it can’t be calculated like 2^x u have to do like Math.pow(2,x)

Can U send me the code please there is also throwing the error…

@sahil_2701
here u go

import java.util.Scanner;
import java.lang.Math;
class Codechef
{
public static void main (String[] args)
{
Scanner read = new Scanner(System.in);

	int t = read.nextInt();
	for(int i=0; i<t; i++)
	{
		int N = read.nextInt();
		int X = read.nextInt();
		int totalSpent = 0;
        double amountRemaining = Math.pow(2,X);

        for (int j = 1; j <= N; j++) {
            int spentI = (int) (0.5 * amountRemaining);
            amountRemaining -= spentI;
            totalSpent += spentI;
        }
        double tm=Math.pow(2,X);
        double amountSaved = tm - totalSpent;
        System.out.println((int)amountSaved);
	}
}

}