-
打印的方式
声明了一个public属性后,tag只需要添加相应的名字即可,省去了每次都要输入。
public static final String TAG = "MainActivity";
Log.d(TAG, tempData);
HashSet<String> hash_mac = new HashSet<>(deviceMac_list);
deviceMac_list.clear();
deviceMac_list.addAll(hash_mac);
private ArrayList<String> deviceMacList = new ArrayList<>();
private ArrayList<String> deviceNameList = new ArrayList<>();
for(int i = 0; i < deviceMac_list.size(); i++){
if (deviceMac_list.get(i).equals(device_mac)){
return;
}
}
-
打印数组的方法
这里的数组可以是byte[]或其他类型。
Log.d(TAG, Arrays.toString(rxData));
float a = 23.4f;
String s = Float.toString(a) ;
int a = 10;
String s = Integer.toString(i);
double a = 10.1234;
String s = Double.toString(i);
String s = "169";
byte b = Byte.parseByte(s);
short t = Short.parseShort(s);
int i = Integer.parseInt(s);
long l = Long.parseLong(s);
Float f = Float.parseFloat(s);
Double d = Double.parseDouble(s);
网友评论