How would I go about changing this from loading .bin to .txt. I would like the information on the .txt file be put into the hashmap just like .bin file.
    public static int currency;
    public HashMap<Integer, Shop> cars = new HashMap<Integer, Car>();    
public void load() {
            try {
                @SuppressWarnings("resource")
                RandomAccessFile carFile = new RandomAccessFile("data/cars.bin", "r");
                int carsAmt = carFile.readShort();
                for (int carId = 0; carId < carAmt; carId++) {
                    int carId = carFile.readShort();
                    int currency = carFile.readShort();
                    int[] cars = new int[carFile.readByte()];
                    int[] amounts = new int[cars.length];
                    boolean isTruck = carFile.read() == 1;
                    for (int carData = 0; carData < cars.length; carData++) {
                        cars[carData] = carFile.readShort();
                        amounts[carData] = carFile.readInt();
                    }
                    cars.put(carId, new Car(carId, currency, isTruck, cars, amounts, true));
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
            System.out.println("Loaded " + cars.size() + " Cars");
        }
 
     
    