public static boolean fileprocess(String downloadpath, String filepath, String sn){

			int errorcode=0;// print error code in the final output file;
			int errornum = 3;
			String result="PASS";

			File downloadfile = new File(downloadpath+"\\factory_image_version.txt");
			File outputfile = new File(filepath);
			

			double value=0;
			String line="";
			ArrayList <String> content = new ArrayList<String>();

			try {			
				
				if (!downloadfile.exists()){
					throw new IOException();
				}
				BufferedReader br = new BufferedReader(new FileReader(downloadfile));
				while ((line=br.readLine())!=null){
					content.add(line);
				}
				br.close();
				
				downloadfile.delete();			
						
				
				if (content.size()!=1){
					result = "FAILED";
					errorcode = 2;
				}
				else{
					value=Double.parseDouble(content.get(0));
				}
				
				

			} catch (IOException e) {
				result = "FAILED";
				errorcode = 0;
			}
				catch (NumberFormatException ex){
					result = "FAILED";
					errorcode = 1;
				}
			
			
			try {
				BufferedWriter bw = new BufferedWriter(new FileWriter(outputfile,true));
				bw.write("SW_Version="+value+"\r\n");
				System.out.println("SW_Version="+value);
				bw.write("SW_Version_Result="+result+"\r\n");
				System.out.println("SW_Version_Result="+result);
				if (result.equals("FAILED")){
					NumberFormat nf = NumberFormat.getIntegerInstance();
					nf.setMinimumIntegerDigits(2);
					bw.write("Error_Code= "+nf.format(errornum)+nf.format(errorcode)+"\r\n");
					System.out.println("Error_Code="+nf.format(errornum)+nf.format(errorcode));
				}
				bw.flush();
				bw.close();
			}catch (Exception e){
				e.printStackTrace();
			}

			return true;
		}