zoukankan      html  css  js  c++  java
  • java.lang.NumberFormatException

    1、错误描写叙述

    Exception in thread "main" java.lang.NumberFormatException: For input string: "61.13226212525146"
    	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    	at java.lang.Integer.parseInt(Integer.java:492)
    	at java.lang.Integer.parseInt(Integer.java:527)
    	at com.you.utils.RandomUtils.findChart(RandomUtils.java:42)
    	at com.you.utils.RandomUtils.main(RandomUtils.java:58)
    

    2、错误原因

          数据格式错误,导致出错


    3、解决的方法

    /**
     *
     * @title:RandomUtils.java
     * @Package:com.you.utils
     * @Description:<h3>一句话描写叙述功能</h3>
     * @author:游海东
     * @date:2015-3-15下午5:19:36
     * @version V1.0
     *
     */
    package com.you.utils;
    
    /**
     *
     * 项目名称:SSH
     * 类名称:RandomUtils
     * 类描写叙述:
     * 创建人:游海东
     * 创建时间:2015-3-15下午5:19:36
     * 改动人:游海东
     * 改动时间:2015-3-15下午5:19:36
     * 改动备注:
     * @version V1.0
     *
     */
    public class RandomUtils 
    {
    	/**
    	 * 
    	 * 方法名:findChart
    	 * 方法类型:RandomUtils
    	 * 參数:@param ch
    	 * 參数:@return
    	 * @return:String
    	 * @throws
    	 */
    	public static String findChart(int ch)
    	{
    		int num = (int)(Math.random()*1000);
    		String charToNumber = String.valueOf(num);
    		
    		return charToNumber;
    	}
    	
    	/**
    	 * 
    	 * 方法名:main
    	 * 方法类型:RandomUtils
    	 * 參数:@param args
    	 * @return :void
    	 * @throws
    	 */
       /* public static void main(String[] args)
        {
        	String str = findChart(2);
        	System.out.println(str);
        }*/
    }
    


  • 相关阅读:
    快速排序
    ABP Error in roboto.css can't resolve '97uahxiqZRoncBaCEI3aWxJtnKITppOI_IvcXXDNrsc.woff2'
    .NET Core Log
    .NET Core的配置文件
    VirtualBox多网卡模式
    Maven 常见错误
    python压缩文件脚本
    Windows7 64bit 安装python3.3 & cx_Freeze-4.3.2
    Ubuntu Linux环境变量
    Ubuntu12.04 64bit 安装 Dropbox
  • 原文地址:https://www.cnblogs.com/gccbuaa/p/6911514.html
Copyright © 2011-2022 走看看