double amount = formatter.parse(amountInReals).doubleValue();
brazilianRealsAmount = brazilianRealsAmount + amount;
if (amount == 0) {
amount = formatter.parse(amountInDollars).doubleValue();
transaction.setCurrency(new Currency());
dolarsAmount = dolarsAmount + amount;
}
transaction.setAmount(-1 * amount);
transaction.setMemo(description);
transactions.add(transaction);
}
pattern = Pattern.compile("X\\s*(\\d+(\\.|,)\\d\\d\\d?\\d?)");
matcher = pattern.matcher(line);
while (matcher.find()) {
exchangeRate = Float.parseFloat(matcher.group(1).replace(',', '.'));
}
pattern = Pattern.compile("Modalidade : (.{30})");
matcher = pattern.matcher(line);
while (matcher.find()) {
accountKey = matcher.group(1).trim();
}
}
}
for (Transaction transaction : transactions) {
Currency currency = transaction.getCurrency();
if (currency != null) {
transaction.setCurrency(null);
double temp = exchangeRate * transaction.getAmount();
transaction.setAmount(temp);
}