Answer:
public class Brainly
{
public static void main(String[] args)
{
BinaryConverter conv = new BinaryConverter();
String binStr = "01001101";
System.out.print(binStr + " in decimal is "+conv.BinToDec(binStr));
}
}
public class BinaryConverter
{
public int BinToDec(String binStr)
{
int d = 0;
while(binStr.length() > 0)
{
d = (d << 1) + ((binStr.charAt(0) == '1') ? 1: 0);
binStr = binStr.substring(1);
}
return d;
}
}
Explanation:
The program "eats" the string from left to right, and builds up the integer representation in variable "d" on the go. While there are digits left, it shifts the previous result to the left and sets the least signficant bit to 1 only if the corresponding string character is a 1.
That would be an Ergonomic keyboard, due to the fact that it is laid out in such a way that doesn't harm your wrists
Answer:
String date = "21/05/2020";
String dayStr = date.substring(0,2);
int day = Integer.parseInt(dayStr);
System.out.println(day);
Explanation:
Create a variable called <em>date</em> which holds the current date
Create a variable called <em>dayStr</em>. Initialize it to the day part of the <em>date</em> using the substring method
Create a variable called <em>day</em>. Parse the <em>dayStr</em> and assign it to the <em>day</em>
Print the <em>day</em>
Flexplace and telecommuting are similar in that both allow you to work in a different location four days a week.