Solves the knapsack problem using genetic algorithm in Java