UtilsTest.java
989 Bytes
package com.viontech.match.util;
import com.viontech.keliu.utils.JsonUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.jupiter.api.Test;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/4/6
*/
class UtilsTest {
@Test
void transferBodyFeature() throws Exception {
List<String> strings = Files.readAllLines(Paths.get("C:\\Users\\vion\\Desktop\\body.feature"));
String s = strings.get(0);
JSONObject jsonObject = JsonUtil.toObject(s);
JSONArray datas = jsonObject.getJSONArray("datas");
JSONObject obj = datas.getJSONObject(0);
JSONArray data = obj.getJSONArray("data");
List<Object> objects = data.toList();
Double[] feature = objects.toArray(new Double[]{});
Double[] doubles = Utils.transferBodyFeature(feature);
System.out.println(Arrays.toString(doubles));
}
}