This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: 'com.android.application' | |
| apply plugin: 'com.neenbedankt.android-apt' | |
| apply plugin: 'me.tatarka.retrolambda' | |
| android { | |
| compileSdkVersion rootProject.androidCompileSdkVersion | |
| buildToolsVersion rootProject.androidBuildToolsVersion | |
| defaultConfig { | |
| minSdkVersion rootProject.androidMinSdkVersion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class HexUtils { | |
| private static final char[] HEX_CHARS = "0123456789ABCDEF".toCharArray(); | |
| private static final String HEX = "0123456789ABCDEF"; | |
| /** | |
| * Convert byte array to hexadecimal string | |
| * @param data Input array | |
| * @return hexadecimal string | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private val HEX_CHARS = "0123456789ABCDEF".toCharArray() | |
| fun ByteArray.toHex() : String{ | |
| val result = StringBuffer() | |
| forEach { | |
| val octet = it.toInt() | |
| val firstIndex = (octet and 0xF0).ushr(4) | |
| val secondIndex = octet and 0x0F | |
| result.append(HEX_CHARS[firstIndex]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final int x; | |
| final int y = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int w; | |
| int z = 2; | |
| z = 3; | |
| w = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final String name = null | |
| String lastName | |
| lastName = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Java | |
| if(text != null){ | |
| int length = text.length(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Java | |
| String name = "John"; | |
| String lastName = "Smith"; | |
| String text = "My name is: " + name + " " + lastName; | |
| String otherText = "My name is: " + name.substring(2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Java | |
| String text = "First Line\n" + | |
| "Second Line\n" + | |
| "Third Line"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Java | |
| String text = x > 5 ? "x > 5" : "x <= 5" |
OlderNewer