/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/bitmanipulation/ClearLeftmostSetBitTest.java
16 строк
580 B
Hardik Pawar
feat: Add ClearLeftmostSetBit new algorithm with Junit tests (#5702)
12 окт 2024, 09:00
Не верифицирован
12 окт 2024, 09:00
966b4e3
Код
Авторство
О чём код?
package com.thealgorithms.bitmanipulation; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; public class ClearLeftmostSetBitTest { @Test public void testClearLeftmostSetBit() { assertEquals(10, ClearLeftmostSetBit.clearLeftmostSetBit(26)); // 11010 -> 01010 assertEquals(0, ClearLeftmostSetBit.clearLeftmostSetBit(1)); // 1 -> 0 assertEquals(3, ClearLeftmostSetBit.clearLeftmostSetBit(7)); // 111 -> 011 assertEquals(2, ClearLeftmostSetBit.clearLeftmostSetBit(6)); // 0110 -> 0010 } }