Use the ‘y’ date conversion character to display two-digit year.System.out.printf("Two-digit Year = %TY", d);Above, d is a date object −Date d = new Date();The following is an example −Example Live Demoimport java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Demo { public static void main(String[] args) throws Exception { Date d = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a"); String format = dateFormat.format(d); System.out.println("Current date and time = " + format); System.out.printf("Four-digit Year = %TY", d); System.out.printf("Two-digit Year = %ty", d); ... Read More
Use the ‘j’ date conversion character to display three-digit day of the year.System.out.printf("Three-digit Day of the Year: %tj/%Tj", d, d);Above, d is a date object −Date d = new Date();The following is an example −Example Live Demoimport java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Demo { public static void main(String[] args) throws Exception { Date d = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a"); String format = dateFormat.format(d); System.out.println("Current date and time = " + format); System.out.printf("Four-digit Year = %TY", d); ... Read More
Use the ‘d’ date conversion character to display two-digit day of the month, for example, 27, 28, 20, etc.System.out.printf("Two-digit day of the month: %td", d);Above, d is a date object −Date d = new Date();The following is an example −Example Live Demoimport java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Demo { public static void main(String[] args) throws Exception { Date d = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a"); String format = dateFormat.format(d); System.out.println("Current date and time = " + format); System.out.printf("Four-digit Year ... Read More
The bits of an integer number can be reversed to obtain another number. An example of this is given as follows −Number = 11 Binary representation = 1011 Reversed binary representation = 1101 Reversed number = 13A program that demonstrates this is given as follows −Example Live Demopublic class Example { public static void main(String[] args) { int num = 14; int n = num; int rev = 0; while (num > 0) { rev = 1; } ... Read More
To list weekday names, use the getWeekdays () from the DateFormatSymbols class in Java.DateFormatSymbols is a class for encapsulating localizable date-time formatting data.Get weekday month names in an array −String[] days = new DateFormatSymbols().getWeekdays ();Display the weekdays −for (int i = 0; i < days.length; i++) { String weekday = days[i]; System.out.println(weekday); }The following is an example −Example Live Demoimport java.text.DateFormatSymbols; public class Demo { public static void main(String[] args) { String[] days = new DateFormatSymbols().getWeekdays(); for (int i = 0; i < days.length; i++) { String weekday ... Read More
In 8085 Instruction set, there a set of instructions which can Accumulator contents left orright. It is to be noted here that rotate operation can be performedonly on Accumulator contents. These instructions set is listed below– Mnemonics, OperandOpcode(in HEX)BytesRAL171RAR1F1RLC071RRC0F1Mnemonic RLC stands for “Rotate Left Accumulator”. It rotates the Accumulator contents to the left by 1-bit position. The following Fig. shows the operation explicitly – In this fig. it has been depicted that the mostsignificant bit of the Accumulator will come out and left rotate willcreate an empty space at the least significant bit place and thiscome out bit will be copied at ... Read More
In 8085 Instruction set, there are a set of jump instructions, which can transfer program control to a certain memory location. So after these branching mnemonics we shall have to mention 16-bit target address of the location. These jump instructions can be divided into two categories– Unconditional jump instructions andConditional jump instructionsUnder unconditional jump instructions there is only one mnemonic i.e. JUMP. But under conditional Jump instructions we are having 8 different mnemonics. We know that there are 5 flag bits in 8085 Flag register. They are S, Z, P, Cy, AC. Out of them only on AC flag bit, there ... Read More
In 8085 Instruction set, there are a set of jump instructions, which can transfer programcontrol to a certain memory location. So after these branchingmnemonics we shall have to mention 16-bit target address of thelocation. These jump instructions can be divided into two categories– Unconditional jump instructions andConditional jump instructionsHere in this section we shall discuss only the unconditional jump instruction. Tre required mnemonic is JUMP a16. Here in this instruction a16 denotes 16-bit memory location address.This instruction does not depend on the current conditions of theflag bits in the flag register. It is a 3-Byte instruction. The firstByte will contain the ... Read More
In 8085 Instruction set, we are having one mnemonic JNC a16, which stands for “Jump if Not Carry” and “a16”stands for any 16-bit address. This instruction is used to jump to the address a16 as provided in the instruction. But as it is a conditional jump so it will happen if and only if the present carry flag value is 0. If carry flag value is 1, program flow continues sequentially. It is a 3-Byte instruction.Mnemonics, OperandOpcode(in HEX)BytesJNCLabelD23Let us consider one example of this instruction type JNC 4000H. It is a 3-Byte instruction. The result of execution of this instruction ... Read More
In 8085 Instruction set, there are a set of jump instructions, which can transfer program control to a certain memory location. So after these branching mnemonics, we shall have to mention 16-bit target address of the location. These jump instructions can be divided into two categories– Unconditional jump instructions andConditional jump instructionsHere we shall discuss conditional jump instructions in details. Under conditional Jump instructions, we are having 8 different mnemonics. We know that there are 5 flag bits in 8085 Flag register. They are S, Z, P, Cy, AC. Out of them only on AC flag bit, there is no jump ... Read More