Guest User

Untitled

a guest
Dec 14th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.86 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Arrays;
  3.  
  4. public class UltimateBravery {
  5.     public static String bar[] = null;
  6.     public static int count = 0;
  7.     public static String boots[] = null;
  8.     public static String spells[] = null;
  9.     public static String champs[] = null;
  10.     public static String skills[] = null;
  11.     public static String items[] = null;
  12.    
  13.     public static int linecount(BufferedReader file) {
  14.         try {
  15.             while(file.readLine() != null) {
  16.                 count++;
  17.             }
  18.             file.close();
  19.         }  
  20.             catch (Exception ex) {
  21.                 ex.printStackTrace();
  22.             }  
  23.        
  24.        
  25.         return count;
  26.     }
  27.    
  28.     public static String[] readfile(String foo) {
  29.    
  30.        
  31.        
  32.         try {
  33.             count = 0;
  34.             BufferedReader br = new BufferedReader (new FileReader (foo));
  35.             bar = new String[linecount(br)];
  36.             br = new BufferedReader (new FileReader (foo));
  37.             for(int i = 0; i <= count-1 ; i++) {
  38.                 bar[i] = br.readLine();
  39.             }
  40.             return bar;
  41.         }      
  42.        
  43.        
  44.        
  45.         catch (IOException blargh) {
  46.             System.out.println(blargh.getMessage());
  47.         }
  48.        
  49.         return bar;    
  50.     }
  51.    
  52.     public static void main(String[] args) {
  53.         readfile("bin\\boots.txt");
  54.         boots = Arrays.copyOf(bar, bar.length);
  55.         readfile("bin\\spells.txt");
  56.         spells = Arrays.copyOf(bar, bar.length);
  57.         readfile("bin\\champs.txt");
  58.         champs = Arrays.copyOf(bar, bar.length);
  59.         readfile("bin\\skills.txt");
  60.         skills = Arrays.copyOf(bar, bar.length);
  61.         readfile("bin\\items.txt");
  62.         items = Arrays.copyOf(bar, bar.length);
  63.        
  64.         for(int i = 0; i < boots.length; i++) {
  65.             System.out.println(boots[i]);
  66.         }
  67.        
  68.         for(int i = 0; i < spells.length; i++) {
  69.             System.out.println(spells[i]);
  70.         }
  71.        
  72.         for(int i = 0; i < champs.length; i++) {
  73.             System.out.println(champs[i]);
  74.         }
  75.        
  76.         for(int i = 0; i < skills.length; i++) {
  77.             System.out.println(skills[i]);
  78.         }
  79.        
  80.         for(int i = 0; i < items.length; i++) {
  81.             System.out.println(items[i]);
  82.         }
  83.         }
  84.     }
  85.  
Advertisement
Add Comment
Please, Sign In to add comment