public void buildAttributeWords(int n){
String sql = "";
ArrayList<String> wordList=new ArrayList<String>();
ArrayList<String> frequencyList=new ArrayList<String>();
sql = "select * from word_frequency where frequency >= '"+ n +"'";
ResultSet rs = operManager.executeQuery(sql);
try {
while(rs.next()){
wordList.add(rs.getString("word"));
frequencyList.add(rs.getString("frequency"));
}
if(wordList != null && wordList.size() > 0){//如果list中存入了数据,转化为数组
String[] wordArray=new String[wordList.size()];//创建一个和list长度一样的数组
int[] frequencyArray=new int[frequencyList.size()];
for(int i = 0;i < wordList.size();i++){
wordArray[i]=wordList.get(i);//数组赋值了。
frequencyArray[i]=Integer.parse
从mysql数据库中将数据存入数组中
最新推荐文章于 2023-10-30 17:21:36 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)