public class FloatDemo {

  public static void main(String[] args) {
    // 字符串转成int型
    String str1 = "2";// 前提必须是由数字组成的字符
    String str2 = "0.2f";
    int x = Integer.parseInt(str1);
    float y = Float.parseFloat(str2);
    System.out.println("整数乘方 ---->" + x*x );
    System.out.println("小数乘方 ---->" + y*y );
  }

}