Niloy007

Max Number

Dec 11th, 2019
149
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Thread;
  2.  
  3. import java.io.*;
  4.  
  5. public class Main {
  6.     public static void main(String[] args) throws Exception {
  7.  
  8.         String absPath = "/Niloy/Test/New/Person.txt";
  9.         String copypath = "/Niloy/Test/New/Student.txt";
  10.  
  11.         FileReader fileReader = new FileReader(absPath);
  12.  
  13.         BufferedReader bufferedReader = new BufferedReader(fileReader);
  14.         String a;
  15.         while((a = bufferedReader.readLine()) != null) {
  16.             String parts[] = a.split(",");
  17.  
  18.             int convert[] = new int[parts.length];
  19.             int max = 0;
  20.  
  21.             for(int i = 0; i < convert.length; i++) {
  22.                 convert[i] = Integer.parseInt(parts[i]);
  23.             }
  24.  
  25.  
  26.             for(int i = 0; i < convert.length; i++) {
  27.                 if(convert[i] > max) {
  28.                     max = convert[i];
  29.                 }
  30.             }
  31.             System.out.println(max);
  32.         }
  33.     }
  34. }
RAW Paste Data