You can also try the modern approach - aggregation structure :
1) Find the maximum value of the array 'for all elements in the collection:
db.collection.aggregate([
{ $unwind: "$array" },
{ $group: { _id: "$_id", value: { $max: "$array.value" } } }
]);
2) Find the maximum value of the array 'for the specified element:
db.collection.aggregate([
{ $match: { _id: new ObjectId("526d89571cd72ce9dbb6b443") } },
{ $unwind: "$array" },
{ $group: { _id: null, value: { $max: "$array.value" } } }
]);
collection.
, Java MongoDB-: Java Driver and Aggregation Framework.