publiclongmyPow(int a,int b){long res =1, x = a;// x初始化为底数while(b !=0){if((b &1)==1){
res = res * x %1000000007;}
x *= x;// x变为x的平方并取余,因为指数变2倍,则底数为底数的平方
x %=1000000007;
b >>=1;}return res;}
```
快速幂模板public long myPow(int a, int b) { long res = 1, x = a; // x初始化为底数 while(b != 0) { if((b & 1) == 1) { res = res * x % 1000000007; } x *= x; // x变为x的平方并取余,因为指数变2倍,则底数为底数的平方