
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Daniol Thomas has Published 242 Answers

Published on 25-Apr-2019 12:34:28
At first, set the date:LocalDateTime dateTime = LocalDateTime.of(2019, Month.JULY, 9, 10, 20);Now, format the datetime as ISO_DATE_TIME format:String str = dateTime.format(DateTimeFormatter.ISO_DATE_TIME);Exampleimport java.time.LocalDateTime; import java.time.Month; import java.time.format.DateTimeFormatter; public class Demo { public static void main(String[] args) { LocalDateTime dateTime = LocalDateTime.of(2019, Month.JULY, 9, 10, 20); ... Read More

Published on 25-Apr-2019 12:32:40
To format and display datetime, you need to use DateTimeFormatter and use the pattern as:DateTimeFormatter dtFormat = DateTimeFormatter.ofPattern("MMM dd yyyy hh:mm a z");Above, the z is the timezone:MMM dd yyyy hh:mm a zNow, use the following for zone:ZonedDateTime dateTime = ZonedDateTime.now();Exampleimport java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; public class Demo { public ... Read More

Published on 25-Apr-2019 12:30:49
To format and display datetime, you need to use DateTimeFormatter. The format style is MEDIUM and SHORT:DateTimeFormatter formatter = DateTimeFormatter .ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT);Display the formatted date:formatter.format(LocalDateTime.now()Exampleimport java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; public class Demo { public static void main(String[] args) { DateTimeFormatter formatter = DateTimeFormatter .ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT); ... Read More

Published on 25-Apr-2019 12:28:24
Following is our file:Path p = Paths.get("E:/input.txt"); FileStore file = Files.getFileStore(p);Now, check for the supported attributes one by one:FileAttributeView = file.supportsFileAttributeView(FileAttributeView.class) PosixFileAttributeView = file.supportsFileAttributeView(PosixFileAttributeView.class) BasicFileAttributeView = file.supportsFileAttributeView(BasicFileAttributeView.class)Exampleimport java.nio.file.FileStore; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.FileAttributeView; import java.nio.file.attribute.FileOwnerAttributeView; import java.nio.file.attribute.PosixFileAttributeView; public class Demo { public static void ... Read More

Published on 24-Apr-2019 11:58:55
Let us first set an Instant:Instant now = Instant.ofEpochMilli(184142540078l);Let us now minus seconds from Instant:Instant resSeconds = now.minusSeconds(50);Let us now minus nanoseconds from Instant:Instant resNanoSeconds = now.minusNanos(10000);Exampleimport java.time.Instant; public class Demo { public static void main(String[] args) { Instant now = Instant.ofEpochMilli(184142540078l); System.out.println(now); ... Read More

Published on 04-Apr-2019 12:56:04
This is a C++ Program to Implement the Edmonds-Karp algorithm to calculate maximum flow between source and sink vertex.Algorithm:Begin function edmondsKarp() : initiate flow as 0. If there is an augmenting path from source to sink, add the path to flow. ... Read More

Published on 04-Apr-2019 12:52:32
This is a C++ Program to implement Network_Flow problem using Ford Fulkerson algorithm.Algorithms:Begin function bfs() returns true if there is path from source s to sink t in the residual graph which indicates additional possible flow in the graph. End Begin function fordfulkarson() return maximum flow in ... Read More

Published on 04-Apr-2019 12:33:04
This is a C++ program to find Maximum Number of Edge Disjoint Paths which means shortest subset path or maximum flow between two vertices.Algorithms:Begin function bfs() returns true if there is path from source s to sink t in the residual graph which indicates additional possible flow in ... Read More

Published on 04-Apr-2019 12:30:00
Here is a C++ Program to Perform Greedy ColoringAlgorithm:Begin Take the number of vertices and edges as input. Create function greedyColoring() to assign color to vertices: A) Assign the first color to first vertex. B) Initialize the remaining vertices. C) Declare a temporary array to ... Read More
Advertisements