How to get the Current Machine Name and Logged In User in Java
It’s very easy to get the current machine name and logged in user using Java.
Get the Currently Logged in User
String username = …
Read Article →
345 articles about java development, tools, and best practices
It’s very easy to get the current machine name and logged in user using Java.
String username = …
Read Article →
Homebrew is the preferred way to install anything on your Mac.
brew install graalvm/tap/graalvm-ce-java17
Java comes with many different ways to generate random integers, even if you need to specify a lower and upper bound to constrain your required value …
Read Article →If you have a traditional array, that looks something like the following:
A[] array = {new A(1), new A(2), new A(3)};
And you would like …
Read Article →Remove all vowels from the string.
Vowels:
a e i o u
A E I O U
Option 1:
public class VowelRemoval {
public …
Read Article →
You are given an array of unique elements, and your task is to rearrange the values so that the first max value is followed by the first …
Read Article →The most basic encryption method is to map a char to another char by a certain math rule. Because every char has an ASCII value, we can …
Read Article →Complete the function that takes an odd integer (0 < n < 1000000) which is the difference between two consecutive perfect squares, …
When given a string of space-separated words, return the word with the longest length.
If there are multiple words with the longest …
Read Article →You must implement a function that returns the difference between the biggest and the smallest value in a list(lst) received as a …
Read Article →Given a string and an array of integers representing indices, capitalize all letters at the given indices.
Example: …
Read Article →Modify the spacify function so that it returns the given string with spaces inserted between each character.
spacify("hello …
Read Article →
Write a simple regex to validate a username. Allowed characters are:
Length should be between 4 …
Read Article →Given two arrays of strings a1 and a2 return a sorted array r in lexicographical order of the strings of a1 which are substrings of …
Your task is to add up letters to one letter.
The function will be given an array of single-character Strings, each one being a letter …
Read Article →You want to create secret messages which must be deciphered.
Here are the conditions:
In this challenge, you have to write a method that folds a given array of integers by the middle x-times.
An example says more than a …
Read Article →Given a list lst and a number N, create a new list that contains each number of lst at most N times without reordering. For example if N …
Read Article →Write a function that accepts a string, and returns true if it is in the form of a phone number.
Assume that any integer from 0-9 in any …
Sort elements in an array by decreasing frequency of elements. If two elements have the same frequency, sort them by increasing value. …
Read Article →Write a function that receives two strings and returns n, where n is equal to the number of characters we should shift the first string …
Read Article →Compare two strings by comparing the sum of their values (ASCII character code).
null …Given two integers a, b, find The sum of them, BUT You are not allowed to use the operators + and –
Notes
Count how many arguments a method is called with.
Examples
args_count(1, 2, 3) -> 3
args_count(1, 2, 3, 10) -> 4