我正在试图制作一个方法来查找向量中整数的最大值。我想一个方法,如如何查找Java文本文件中的int标记的最大值
/**
* The method returns an integer.
* The integer is the greatest value of all tagValues of the lab devices
*/
public int findMaximumValueTag()
变量值将在一个文本文件中的设备旁的整数,在每一行,如
Android,53
Blackberry2,-95
iPhone,45
因此,与上述情况,该方法应该返回53.
包含方法是如下的类的开始:
public class Lab implements MaxTagValue {
String labName;
Vector<MobileDevice> devices;
的y帮助所有伪代码或任何东西将非常感激,让这个开始,非常感谢你!
另外,移动设备类的开头如下:
public class MobileDevice {
String deviceName; // the device name
int valueTag; // an integer between -100 and 100
Lab lab; // the lab having this device it its inventory
在文件中找到的所有号码,如[这个答案]以下(http://stackoverflow.com/questions/3806062/how-to-open-a-txt-file-and-read-numbers-in-java),然后简单地找到最大值。 – DimaSan