public int setCurrency(int amount)
  {
    ownCurrency = amount;

    int overflow = ownCurrency - 3904;

    int large = (int)Math.floor(ownCurrency / largeCurrency);

    if (large > 0)
      inventory.setItem(2, new ItemStack(largeCurrencyItem.getType(), large));
    else {
      inventory.clear(2);
    }

    int medium = (int)Math.floor((ownCurrency - largeCurrency * large) / mediumCurrency);
    if (medium > 0)
      inventory.setItem(1, new ItemStack(mediumCurrencyItem.getType(), medium));
    else {
      inventory.clear(1);
    }

    int small = (int)Math.floor(ownCurrency - largeCurrency * large - mediumCurrency * medium) / smallCurrency;

    if (small > 0)
      inventory.setItem(0, new ItemStack(smallCurrencyItem.getType(), small));
    else {
      inventory.clear(0);
    }

    return overflow;
  }