length
(Если бы это был массив int[], можно использовать length), для определения размера у List нужно использовать метод size()
. Scanner input = new Scanner(System.in);
ArrayList<Integer> array = new ArrayList<>();
int max = 0;
System.out.println("Введите числа");
for(int number = input.nextInt() ; number != 0; number = input.nextInt()) {
array.add(number);
}
for (int i = 0; i < array.size(); i++) {
if (array.get(i) > max) {
max = array.get(i);
}
}
System.out.println("Это число: "+max);
var prices = new String[] {
"100 ₽",
"$4,99",
"9,99 €",
"100 CA$",
"9,49 USD"
};
//Паттерн
final var pattern = "[\\d\\s.,]+";
var resultSet = Arrays.stream(prices)
.map(price -> price.replaceFirst(pattern, ""))//Вырезаем все совпадения
.collect(Collectors.toSet());//собираем в Set
resultSet.forEach(System.out::println);
JNIEXPORT jint JNICALL Java_BlackLib_BlackSPI__1transfer(JNIEnv *env, jclass obj, jint writeBuffer, jint readBuffer, jint bufferSize, jint wait_us)
{
return spi->transfer((uint8_t*) & writeBuffer, (uint8_t*) & readBuffer, sizeof (readBuffer), 0);
}
public class DrawerItemClickListener implements ListView.OnItemClickListener {
FragmentTransaction transaction;
FragmentManager manager;
AbstractionFragment createMenuFragment;
AbstractionFragment watchProgressFragment;
AbstractionFragment settingMenuFragment;
public DrawerItemClickListener(FragmentManager m) {
manager = m;
transaction = manager.beginTransaction();
createMenuFragment = new CreateMenuFragment();
watchProgressFragment = new WatchProgressFragment();
settingMenuFragment = new SettingMenuFragment();
}
...
}
drawerList.setOnItemClickListener(new DrawerItemClickListener(getSupportFragmentManager()));
table: student_group
+-------------+-----------+
| student_id | group_id |
+-------------+-----------+
| 1 | 4 |
+-------------+-----------+
| 1 | 5 |
+-------------+-----------+
| 1 | 10 |
+-------------+-----------+
| 1 | 99 |
+-------------+-----------+
| 2 | 8 |
+-------------+-----------+
| 2 | 30 |
+-------------+-----------+
array = null;
public Test () {
String a = "";
try {
a = bytesToHex(mAES.encrypt("test"));
} catch (Exception e) {
e.printStackTrace();
}
try {
a = mAES.decrypt(hexToBytes(a));
} catch (Exception e) {
e.printStackTrace();
}
}
public static String bytesToHex(byte[] data) {
if (data==null)
{
return null;
}
int len = data.length;
String str = "";
for (int i=0; i<len; i++) {
if ((data[i]&0xFF)<16)
str = str + "0" + java.lang.Integer.toHexString(data[i]&0xFF);
else
str = str + java.lang.Integer.toHexString(data[i]&0xFF);
}
return str;
}
public static byte[] hexToBytes(String str) {
if (str==null) {
return null;
} else if (str.length() < 2) {
return null;
} else {
int len = str.length() / 2;
byte[] buffer = new byte[len];
for (int i=0; i<len; i++) {
buffer[i] = (byte) Integer.parseInt(str.substring(i*2,i*2+2),16);
}
return buffer;
}
}